Browse Source

屏蔽redis数据集中脚本功能(性能瓶颈)

pull/12/head
richie 6 years ago
parent
commit
c239114623
  1. 2
      plugin.xml
  2. 3
      src/main/java/com/fr/plugin/db/redis/core/RedisDatabaseConnection.java
  3. 73
      src/main/java/com/fr/plugin/db/redis/core/RedisNode.java
  4. 1
      src/main/java/com/fr/plugin/db/redis/core/RedisPool.java
  5. 11
      src/main/java/com/fr/plugin/db/redis/ui/RedisQueryPane.java
  6. 17
      src/main/java/com/fr/plugin/db/redis/ui/RedisTableDataPane.java

2
plugin.xml

@ -9,7 +9,7 @@
<vendor>richie</vendor>
<description><![CDATA[可以连接Redis数据库,支持哈希表、列表、集合以及有序集合]]></description>
<change-notes><![CDATA[
[2019-03-21]增加代理服务配置<br/>
[2019-03-21]现在可以通过跳板服务连接redis<br/>
[2019-03-18]修复连接没有释放的问题。<br/>
[2019-03-18]增加程序数据集,可以使用javascript进行取数,需要2019-03-01之后的版本。<br/>
[2019-02-15]结果集可以通过JavaScript脚本进行转换。<br/>

3
src/main/java/com/fr/plugin/db/redis/core/RedisDatabaseConnection.java

@ -2,6 +2,7 @@ package com.fr.plugin.db.redis.core;
import com.fr.config.holder.Conf;
import com.fr.config.holder.factory.Holders;
import com.fr.config.holder.impl.ColConf;
import com.fr.data.impl.AbstractDatabaseConnection;
import com.fr.data.impl.Connection;
import com.fr.locale.InterProviderFactory;
@ -14,6 +15,8 @@ import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader;
import com.fr.third.redis.clients.jedis.Jedis;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Set;

73
src/main/java/com/fr/plugin/db/redis/core/RedisNode.java

@ -0,0 +1,73 @@
package com.fr.plugin.db.redis.core;
import com.fr.config.holder.Conf;
import com.fr.config.holder.factory.Holders;
import com.fr.config.utils.UniqueKey;
import com.fr.stable.AssistUtils;
import com.fr.stable.StringUtils;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-03-22
*/
public class RedisNode extends UniqueKey {
public static final int DEFAULT_REDIS_PORT = 6379;
private Conf<String> host = Holders.simple(StringUtils.EMPTY);
private Conf<Integer> port = Holders.simple(DEFAULT_REDIS_PORT);
private Conf<String> password = Holders.simple(StringUtils.EMPTY);
public RedisNode(String host, int port, String password) {
this.setHost(host);
this.setPort(port);
this.setPassword(password);
}
public String getHost() {
return host.get();
}
public void setHost(String host) {
this.host.set(host);
}
public int getPort() {
return port.get();
}
public void setPort(int port) {
this.port.set(port);
}
public String getPassword() {
return password.get();
}
public void setPassword(String password) {
this.password.set(password);
}
@Override
public boolean equals(Object obj) {
return obj instanceof RedisNode
&& AssistUtils.equals(((RedisNode) obj).getHost(), getHost())
&& ((RedisNode) obj).getPort() == getPort()
&& AssistUtils.equals(((RedisNode) obj).getPassword(), getPassword());
}
@Override
public int hashCode() {
return AssistUtils.hashCode(getHost(), getPort(), getPassword());
}
@Override
public Object clone() throws CloneNotSupportedException {
RedisNode cloned = (RedisNode) super.clone();
cloned.host = (Conf<String>) host.clone();
cloned.port = (Conf<Integer>) port.clone();
cloned.password = (Conf<String>) password.clone();
return cloned;
}
}

1
src/main/java/com/fr/plugin/db/redis/core/RedisPool.java

@ -13,6 +13,7 @@ import com.fr.ssh.jsch.JSchException;
import com.fr.ssh.jsch.Session;
import com.fr.stable.StringUtils;
import com.fr.third.redis.clients.jedis.Jedis;
import com.fr.third.redis.clients.jedis.JedisCluster;
import com.fr.third.redis.clients.jedis.JedisPool;
import com.fr.third.redis.clients.jedis.JedisPoolConfig;
import com.fr.transaction.Configurations;

11
src/main/java/com/fr/plugin/db/redis/ui/RedisQueryPane.java

@ -61,16 +61,17 @@ public class RedisQueryPane extends BasicPane {
Component[][] coms = new Component[][]{
{new UILabel(Toolkit.i18nText("Plugin-Redis_DB_Index") + ":"), dbIndexEditor},
{GUICoreUtils.createBorderLayoutPane(new UILabel(Toolkit.i18nText("Plugin-Redis_Query_Condition") + ":"), BorderLayout.NORTH),
RedisDesignUtils.createConditionTextPane(sqlTextPane, SyntaxConstants.SYNTAX_STYLE_SQL, 100)},
{GUICoreUtils.createBorderLayoutPane(new UILabel(Toolkit.i18nText("Plugin-Redis_Script_Text") + ":"), BorderLayout.NORTH),
RedisDesignUtils.createConditionTextPane(scriptTextPane, SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT, 200)
},
RedisDesignUtils.createConditionTextPane(sqlTextPane, SyntaxConstants.SYNTAX_STYLE_SQL, 300)}
};
// {GUICoreUtils.createBorderLayoutPane(new UILabel(Toolkit.i18nText("Plugin-Redis_Script_Text") + ":"), BorderLayout.NORTH),
// RedisDesignUtils.createConditionTextPane(scriptTextPane, SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT, 200)
// }
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] rowSize = {p, p, p};
double[] rowSize = {p, p};
double[] columnSize = {p, f};
add(TableLayoutHelper.createTableLayoutPane(coms, rowSize, columnSize));

17
src/main/java/com/fr/plugin/db/redis/ui/RedisTableDataPane.java

@ -1,31 +1,14 @@
package com.fr.plugin.db.redis.ui;
import com.fr.base.BaseUtils;
import com.fr.base.ParameterHelper;
import com.fr.data.impl.NameDatabaseConnection;
import com.fr.design.actions.UpdateAction;
import com.fr.design.data.datapane.preview.PreviewTablePane;
import com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane;
import com.fr.design.gui.itableeditorpane.ParameterTableModel;
import com.fr.design.gui.itableeditorpane.UITableEditAction;
import com.fr.design.gui.itableeditorpane.UITableEditorPane;
import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.i18n.Toolkit;
import com.fr.design.menu.ToolBarDef;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.plugin.db.redis.core.RedisTableData;
import com.fr.plugin.db.redis.core.order.OrderValue;
import com.fr.script.Calculator;
import com.fr.stable.ArrayUtils;
import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.FocusEvent;
import java.util.ArrayList;
import java.util.List;

Loading…
Cancel
Save