Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
financial-sdk
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
QG
financial-sdk
Commits
5ce33830
Commit
5ce33830
authored
Jul 25, 2016
by
Java-刘 彧阳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加代码
parent
5cbc2276
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
307 additions
and
12 deletions
+307
-12
uiDesigner.xml
.idea/uiDesigner.xml
+124
-0
.gitkeep
src/.gitkeep
+0
-0
.gitkeep
src/main/.gitkeep
+0
-0
.gitkeep
src/main/java/.gitkeep
+0
-0
ChannelPool.java
src/main/java/cn/quantgroup/fs/ChannelPool.java
+73
-0
ChannelPoolFactory.java
src/main/java/cn/quantgroup/fs/ChannelPoolFactory.java
+57
-0
PropertyHolder.java
src/main/java/cn/quantgroup/fs/PropertyHolder.java
+41
-0
.gitkeep
src/main/resources/.gitkeep
+0
-0
config.properties
src/main/resources/config/beta/config.properties
+6
-6
config.properties
src/main/resources/config/product/config.properties
+6
-6
No files found.
.idea/uiDesigner.xml
0 → 100644
View file @
5ce33830
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"Palette2"
>
<group
name=
"Swing"
>
<item
class=
"com.intellij.uiDesigner.HSpacer"
tooltip-text=
"Horizontal Spacer"
icon=
"/com/intellij/uiDesigner/icons/hspacer.png"
removable=
"false"
auto-create-binding=
"false"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"1"
hsize-policy=
"6"
anchor=
"0"
fill=
"1"
/>
</item>
<item
class=
"com.intellij.uiDesigner.VSpacer"
tooltip-text=
"Vertical Spacer"
icon=
"/com/intellij/uiDesigner/icons/vspacer.png"
removable=
"false"
auto-create-binding=
"false"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"6"
hsize-policy=
"1"
anchor=
"0"
fill=
"2"
/>
</item>
<item
class=
"javax.swing.JPanel"
icon=
"/com/intellij/uiDesigner/icons/panel.png"
removable=
"false"
auto-create-binding=
"false"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"3"
hsize-policy=
"3"
anchor=
"0"
fill=
"3"
/>
</item>
<item
class=
"javax.swing.JScrollPane"
icon=
"/com/intellij/uiDesigner/icons/scrollPane.png"
removable=
"false"
auto-create-binding=
"false"
can-attach-label=
"true"
>
<default-constraints
vsize-policy=
"7"
hsize-policy=
"7"
anchor=
"0"
fill=
"3"
/>
</item>
<item
class=
"javax.swing.JButton"
icon=
"/com/intellij/uiDesigner/icons/button.png"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"3"
anchor=
"0"
fill=
"1"
/>
<initial-values>
<property
name=
"text"
value=
"Button"
/>
</initial-values>
</item>
<item
class=
"javax.swing.JRadioButton"
icon=
"/com/intellij/uiDesigner/icons/radioButton.png"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"3"
anchor=
"8"
fill=
"0"
/>
<initial-values>
<property
name=
"text"
value=
"RadioButton"
/>
</initial-values>
</item>
<item
class=
"javax.swing.JCheckBox"
icon=
"/com/intellij/uiDesigner/icons/checkBox.png"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"3"
anchor=
"8"
fill=
"0"
/>
<initial-values>
<property
name=
"text"
value=
"CheckBox"
/>
</initial-values>
</item>
<item
class=
"javax.swing.JLabel"
icon=
"/com/intellij/uiDesigner/icons/label.png"
removable=
"false"
auto-create-binding=
"false"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"0"
anchor=
"8"
fill=
"0"
/>
<initial-values>
<property
name=
"text"
value=
"Label"
/>
</initial-values>
</item>
<item
class=
"javax.swing.JTextField"
icon=
"/com/intellij/uiDesigner/icons/textField.png"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"true"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"6"
anchor=
"8"
fill=
"1"
>
<preferred-size
width=
"150"
height=
"-1"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JPasswordField"
icon=
"/com/intellij/uiDesigner/icons/passwordField.png"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"true"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"6"
anchor=
"8"
fill=
"1"
>
<preferred-size
width=
"150"
height=
"-1"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JFormattedTextField"
icon=
"/com/intellij/uiDesigner/icons/formattedTextField.png"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"true"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"6"
anchor=
"8"
fill=
"1"
>
<preferred-size
width=
"150"
height=
"-1"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JTextArea"
icon=
"/com/intellij/uiDesigner/icons/textArea.png"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"true"
>
<default-constraints
vsize-policy=
"6"
hsize-policy=
"6"
anchor=
"0"
fill=
"3"
>
<preferred-size
width=
"150"
height=
"50"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JTextPane"
icon=
"/com/intellij/uiDesigner/icons/textPane.png"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"true"
>
<default-constraints
vsize-policy=
"6"
hsize-policy=
"6"
anchor=
"0"
fill=
"3"
>
<preferred-size
width=
"150"
height=
"50"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JEditorPane"
icon=
"/com/intellij/uiDesigner/icons/editorPane.png"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"true"
>
<default-constraints
vsize-policy=
"6"
hsize-policy=
"6"
anchor=
"0"
fill=
"3"
>
<preferred-size
width=
"150"
height=
"50"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JComboBox"
icon=
"/com/intellij/uiDesigner/icons/comboBox.png"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"true"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"2"
anchor=
"8"
fill=
"1"
/>
</item>
<item
class=
"javax.swing.JTable"
icon=
"/com/intellij/uiDesigner/icons/table.png"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"6"
hsize-policy=
"6"
anchor=
"0"
fill=
"3"
>
<preferred-size
width=
"150"
height=
"50"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JList"
icon=
"/com/intellij/uiDesigner/icons/list.png"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"6"
hsize-policy=
"2"
anchor=
"0"
fill=
"3"
>
<preferred-size
width=
"150"
height=
"50"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JTree"
icon=
"/com/intellij/uiDesigner/icons/tree.png"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"6"
hsize-policy=
"6"
anchor=
"0"
fill=
"3"
>
<preferred-size
width=
"150"
height=
"50"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JTabbedPane"
icon=
"/com/intellij/uiDesigner/icons/tabbedPane.png"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"3"
hsize-policy=
"3"
anchor=
"0"
fill=
"3"
>
<preferred-size
width=
"200"
height=
"200"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JSplitPane"
icon=
"/com/intellij/uiDesigner/icons/splitPane.png"
removable=
"false"
auto-create-binding=
"false"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"3"
hsize-policy=
"3"
anchor=
"0"
fill=
"3"
>
<preferred-size
width=
"200"
height=
"200"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JSpinner"
icon=
"/com/intellij/uiDesigner/icons/spinner.png"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"true"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"6"
anchor=
"8"
fill=
"1"
/>
</item>
<item
class=
"javax.swing.JSlider"
icon=
"/com/intellij/uiDesigner/icons/slider.png"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"6"
anchor=
"8"
fill=
"1"
/>
</item>
<item
class=
"javax.swing.JSeparator"
icon=
"/com/intellij/uiDesigner/icons/separator.png"
removable=
"false"
auto-create-binding=
"false"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"6"
hsize-policy=
"6"
anchor=
"0"
fill=
"3"
/>
</item>
<item
class=
"javax.swing.JProgressBar"
icon=
"/com/intellij/uiDesigner/icons/progressbar.png"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"6"
anchor=
"0"
fill=
"1"
/>
</item>
<item
class=
"javax.swing.JToolBar"
icon=
"/com/intellij/uiDesigner/icons/toolbar.png"
removable=
"false"
auto-create-binding=
"false"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"6"
anchor=
"0"
fill=
"1"
>
<preferred-size
width=
"-1"
height=
"20"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JToolBar$Separator"
icon=
"/com/intellij/uiDesigner/icons/toolbarSeparator.png"
removable=
"false"
auto-create-binding=
"false"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"0"
anchor=
"0"
fill=
"1"
/>
</item>
<item
class=
"javax.swing.JScrollBar"
icon=
"/com/intellij/uiDesigner/icons/scrollbar.png"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"6"
hsize-policy=
"0"
anchor=
"0"
fill=
"2"
/>
</item>
</group>
</component>
</project>
\ No newline at end of file
src/.gitkeep
deleted
100644 → 0
View file @
5cbc2276
src/main/.gitkeep
deleted
100644 → 0
View file @
5cbc2276
src/main/java/.gitkeep
deleted
100644 → 0
View file @
5cbc2276
src/main/java/cn/quantgroup/fs/ChannelPool.java
0 → 100644
View file @
5ce33830
package
cn
.
quantgroup
.
fs
;
import
com.rabbitmq.client.Channel
;
import
com.rabbitmq.client.ConfirmListener
;
import
com.rabbitmq.client.Connection
;
import
com.rabbitmq.client.ConnectionFactory
;
import
org.apache.commons.pool2.impl.GenericObjectPool
;
/**
* Created by Miraculous on 16/7/3.
*/
public
class
ChannelPool
{
private
GenericObjectPool
<
Channel
>
pool
;
private
Connection
connection
=
null
;
private
void
init
(
ConfirmListener
confirmListener
)
{
try
{
PropertyHolder
propertyHolder
=
new
PropertyHolder
();
String
rabbitHost
=
propertyHolder
.
getProperty
(
"fs.rabbitmq.host"
);
int
rabbitPort
=
Integer
.
parseInt
(
propertyHolder
.
getProperty
(
"fs.rabbitmq.port"
));
String
user
=
propertyHolder
.
getProperty
(
"fs.rabbitmq.user"
);
String
password
=
propertyHolder
.
getProperty
(
"fs.rabbitmq.password"
);
String
vhost
=
propertyHolder
.
getProperty
(
"fs.rabbitmq.vhost"
);
ConnectionFactory
factory
=
new
ConnectionFactory
();
factory
.
setUsername
(
user
);
factory
.
setPassword
(
password
);
factory
.
setVirtualHost
(
vhost
);
factory
.
setHost
(
rabbitHost
);
factory
.
setPort
(
rabbitPort
);
factory
.
setAutomaticRecoveryEnabled
(
true
);
factory
.
setConnectionTimeout
(
20000
);
connection
=
factory
.
newConnection
();
ChannelPoolFactory
cf
=
new
ChannelPoolFactory
(
connection
,
confirmListener
);
pool
=
new
GenericObjectPool
<>(
cf
);
pool
.
setMaxTotal
(
100
);
pool
.
setMaxWaitMillis
(
30000
);
pool
.
setMaxIdle
(
8
);
pool
.
setMinIdle
(
2
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
System
.
exit
(-
1
);
}
}
protected
ChannelPool
(
ConfirmListener
confirmableMsgListener
)
{
init
(
confirmableMsgListener
);
}
public
Channel
borrowObject
()
throws
Exception
{
return
pool
.
borrowObject
();
}
public
void
returnObject
(
Channel
channel
)
throws
Exception
{
pool
.
returnObject
(
channel
);
}
public
void
close
()
{
try
{
//關閉 Pool
pool
.
close
();
//關閉rabbitmq connection
this
.
connection
.
close
();
}
catch
(
Exception
e
)
{
// logger.error("error:", e);
}
}
}
src/main/java/cn/quantgroup/fs/ChannelPoolFactory.java
0 → 100644
View file @
5ce33830
package
cn
.
quantgroup
.
fs
;
import
com.rabbitmq.client.Channel
;
import
com.rabbitmq.client.ConfirmListener
;
import
com.rabbitmq.client.Connection
;
import
com.rabbitmq.client.ConnectionFactory
;
import
org.apache.commons.pool2.BasePooledObjectFactory
;
import
org.apache.commons.pool2.PooledObject
;
import
org.apache.commons.pool2.impl.DefaultPooledObject
;
/**
* Created by Miraculous on 16/7/3.
*/
public
class
ChannelPoolFactory
extends
BasePooledObjectFactory
<
Channel
>
{
private
Connection
connection
;
private
ConfirmListener
confirmListener
;
public
ChannelPoolFactory
(
Connection
c
)
{
this
(
c
,
null
);
}
public
ChannelPoolFactory
(
Connection
c
,
ConfirmListener
confirmListener
)
{
this
.
connection
=
c
;
this
.
confirmListener
=
confirmListener
;
}
@Override
public
Channel
create
()
throws
Exception
{
Channel
channel
=
connection
.
createChannel
();
if
(
this
.
confirmListener
!=
null
)
{
channel
.
addConfirmListener
(
confirmListener
);
}
return
channel
;
}
@Override
public
PooledObject
<
Channel
>
wrap
(
Channel
channel
)
{
return
new
DefaultPooledObject
<>(
channel
);
}
@Override
public
void
passivateObject
(
PooledObject
<
Channel
>
p
)
throws
Exception
{
super
.
passivateObject
(
p
);
}
@Override
public
boolean
validateObject
(
PooledObject
<
Channel
>
p
)
{
Channel
channel
=
p
.
getObject
();
return
channel
.
isOpen
();
}
@Override
public
void
destroyObject
(
PooledObject
<
Channel
>
p
)
throws
Exception
{
p
.
getObject
().
close
();
}
}
src/main/java/cn/quantgroup/fs/PropertyHolder.java
0 → 100644
View file @
5ce33830
package
cn
.
quantgroup
.
fs
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.util.Properties
;
/**
* Created by Miraculous on 16/6/30.
*/
class
PropertyHolder
{
private
Properties
properties
=
new
Properties
();
public
PropertyHolder
()
{
InputStream
stream
=
null
;
try
{
stream
=
PropertyHolder
.
class
.
getResourceAsStream
(
"/config.properties"
);
properties
.
load
(
stream
);
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
"fs can not init, reason: "
+
e
.
getMessage
());
System
.
exit
(-
1
);
}
finally
{
if
(
null
!=
stream
)
{
try
{
stream
.
close
();
}
catch
(
IOException
e
)
{
// ignore
}
}
}
}
public
String
getProperty
(
String
propertyName
)
{
if
(!
properties
.
containsKey
(
propertyName
))
{
System
.
out
.
println
(
"can not find property with name in fs sdk: "
+
propertyName
);
System
.
exit
(-
1
);
}
return
properties
.
getProperty
(
propertyName
);
}
}
src/main/resources/.gitkeep
deleted
100644 → 0
View file @
5cbc2276
src/main/resources/config/beta/config.properties
View file @
5ce33830
sms.rabbitmq.host
=
192.168.192.243
fs.rabbitmq.host
=
192.168.192.243
sms.rabbitmq.port
=
5672
fs.rabbitmq.port
=
5672
sms.rabbitmq.user
=
rabbit_admin
fs.rabbitmq.user
=
rabbit_admin
sms.rabbitmq.password
=
abc1234
fs.rabbitmq.password
=
abc1234
sms.rabbitmq.exchange-name
=
sms-control
fs.rabbitmq.exchange-name
=
fs-control
sms.rabbitmq.vhost
=
sms
fs.rabbitmq.vhost
=
fs
\ No newline at end of file
\ No newline at end of file
src/main/resources/config/product/config.properties
View file @
5ce33830
sms.rabbitmq.host
=
192.168.192.243
fs.rabbitmq.host
=
192.168.192.243
sms.rabbitmq.port
=
5672
fs.rabbitmq.port
=
5672
sms.rabbitmq.user
=
rabbit_admin
fs.rabbitmq.user
=
rabbit_admin
sms.rabbitmq.password
=
abc1234
fs.rabbitmq.password
=
abc1234
sms.rabbitmq.exchange-name
=
sms-control
fs.rabbitmq.exchange-name
=
fs-control
sms.rabbitmq.vhost
=
sms
fs.rabbitmq.vhost
=
fs
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment