Skip to content

Commit 7e3d54d

Browse files
committed
cleanup, formatting, tabs/spaces, ide warnings
1 parent c9245b4 commit 7e3d54d

17 files changed

+43
-268
lines changed

common-tools/clas-io/src/main/java/org/jlab/io/ring/DataDistributionRing.java

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
/*
2-
* To change this license header, choose License Headers in Project Properties.
3-
* To change this template file, choose Tools | Templates
4-
* and open the template in the editor.
5-
*/
61
package org.jlab.io.ring;
72

83
import java.util.logging.Level;
@@ -38,19 +33,10 @@ public DataDistributionRing(){
3833
*/
3934
public void initProxy(){
4035
try {
41-
4236
String host = xMsgUtil.localhost();
4337
xMsgProxyAddress address = new xMsgProxyAddress(host,xMsgConstants.DEFAULT_PORT);
4438
System.out.println("\n >>>>> starting xmsg proxy : " + host + "/" + xMsgConstants.DEFAULT_PORT);
4539
proxy = new xMsgProxy(xMsgContext.newContext(), address);
46-
47-
/* Runtime.getRuntime().addShutdownHook(new Thread() {
48-
@Override
49-
public void run() {
50-
xMsgContext.destroyContext();
51-
proxy.shutdown();
52-
}
53-
});*/
5440
proxy.start();
5541
System.out.println("\n >>>>> starting xmsg proxy : success");
5642
} catch (xMsgException ex) {
@@ -69,14 +55,6 @@ public void initRegistrar(){
6955
try {
7056
xMsgRegAddress address = new xMsgRegAddress("localhost", xMsgConstants.REGISTRAR_PORT);
7157
xMsgRegistrar registrar = new xMsgRegistrar(xMsgContext.newContext(), address);
72-
/* Runtime.getRuntime().addShutdownHook(new Thread() {
73-
@Override
74-
public void run() {
75-
xMsgContext.destroyContext();
76-
registrar.shutdown();
77-
}
78-
});*/
79-
8058
registrar.start();
8159
System.out.println("\n >>>>> starting xmsg registrar : success");
8260
} catch (xMsgException ex) {
@@ -88,35 +66,14 @@ public void initRing(){
8866
producer = new DataRingProducer();
8967
producer.setDelay(3000);
9068
producer.start();
91-
/*
92-
Runtime.getRuntime().addShutdownHook(new Thread() {
93-
@Override
94-
public void run() {
95-
96-
System.out.println("\n\n\n");
97-
System.out.println(" ********* Graceful exit initiated");
98-
producer.shutdown();
99-
xMsgContext.destroyContext();
100-
System.out.println(" ********* Destroying xMsg context : done");
101-
registrar.shutdown();
102-
System.out.println(" ********* Registrar shudown : done");
103-
proxy.shutdown();
104-
System.out.println(" ********* Proxy service shudown : done");
105-
System.out.println(" ********* Exiting Data Distribution\n\n");
106-
System.exit(0);
107-
}
108-
});*/
10969
}
11070

11171
public void shutdown(){
11272
System.out.println("\n\n\n");
11373
System.out.println(" ********* Graceful exit initiated");
11474
producer.shutdown();
115-
11675
System.out.println(" ********* Destroying xMsg context : done");
117-
11876
registrar.shutdown();
119-
12077
System.out.println(" ********* Registrar shudown : done");
12178
proxy.shutdown();
12279
System.out.println(" ********* Proxy service shudown : done");

common-tools/clas-io/src/main/java/org/jlab/io/ring/DataRingProducer.java

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
/*
2-
* To change this license header, choose License Headers in Project Properties.
3-
* To change this template file, choose Tools | Templates
4-
* and open the template in the editor.
5-
*/
61
package org.jlab.io.ring;
72

83
import java.util.logging.Level;
@@ -34,6 +29,7 @@ public class DataRingProducer extends xMsg {
3429
public DataRingProducer(){
3530
super("DataRingProducer");
3631
}
32+
3733
/**
3834
* sets the sleep timer after each event has been published.
3935
* @param delay
@@ -45,28 +41,22 @@ public void setDelay(int delay){
4541
public void updateList(){
4642

4743
}
44+
4845
/**
4946
* Start publisher service. establishes connection
5047
*/
5148
public void start(){
5249

5350
try {
54-
5551
connection = getConnection();
56-
5752
final String domain = "clas12domain";
5853
final String subject = "clas12data";
5954
final String typeHipo = "data-hipo";
6055
final String typeEvio = "data-evio";
61-
6256
final String description = "clas12 data distribution ring";
63-
6457
topicHipo = xMsgTopic.build(domain, subject, typeHipo);
6558
topicEvio = xMsgTopic.build(domain, subject, typeEvio);
66-
6759
register(xMsgRegInfo.publisher(topicHipo, description));
68-
//register(xMsgRegInfo.publisher(topicEvio, description));
69-
7060

7161
} catch (xMsgException ex) {
7262
Logger.getLogger(DataRingProducer.class.getName()).log(Level.SEVERE, null, ex);
@@ -89,23 +79,17 @@ public void addEvioEvent(EvioDataEvent event){
8979
System.out.println(" >>>>>> published message : size = " + b.length);
9080
System.out.println(" >>>>>> delay " + publishDelay + " ms");
9181
}
92-
//this.publishCounter++;
9382
}
9483

95-
9684
public void shutdown(){
97-
9885
this.unsubscribeAll();
9986
this.connection.close();
10087
this.destroy();
10188
}
10289

10390
public void addEvent(HipoDataEvent event){
104-
10591
byte[] b = event.getEventBuffer().array();
106-
10792
xMsgMessage msg = new xMsgMessage(topicHipo,"data/hipo",b);
108-
10993
try {
11094
this.publish(connection, msg);
11195
} catch (xMsgException ex) {
@@ -119,7 +103,6 @@ public void addEvent(HipoDataEvent event){
119103
this.publishCounter++;
120104
}
121105

122-
123106
public static void main(String[] args){
124107
int delay = Integer.parseInt(args[0]);
125108
String file = args[1];

common-tools/clas-io/src/main/java/org/jlab/io/stream/EvioInputStream.java

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
/*
2-
* To change this license header, choose License Headers in Project Properties.
3-
* To change this template file, choose Tools | Templates
4-
* and open the template in the editor.
5-
*/
6-
71
package org.jlab.io.stream;
82

93
import java.io.File;
@@ -35,19 +29,16 @@ public class EvioInputStream {
3529

3630
private ByteOrder storeByteOrder = ByteOrder.BIG_ENDIAN;
3731
private EvioCompactReader evioReader = null;
38-
private int currentEvent;
3932
private int currentFileEntries;
4033
private EvioCompactStructureHandler cStructure = null;
4134

4235
public void open(String filename){
4336
try {
4437
evioReader = new EvioCompactReader(new File(filename));
45-
currentEvent = 1;
4638
currentFileEntries = evioReader.getEventCount();
4739
storeByteOrder = evioReader.getFileByteOrder();
4840
System.out.println("****** opened FILE [] ** NEVENTS = " +
4941
currentFileEntries + " *******");
50-
// TODO Auto-generated method stub
5142
} catch (EvioException ex) {
5243
Logger.getLogger(EvioSource.class.getName()).log(Level.SEVERE, null, ex);
5344
} catch (IOException ex) {
@@ -56,14 +47,14 @@ public void open(String filename){
5647
}
5748

5849
public Map<Integer,String> getKeys(){
59-
Map<Integer,String> keymap = new HashMap<Integer,String>();
50+
Map<Integer,String> keymap = new HashMap<>();
6051
return keymap;
6152
}
6253

6354
public int getEntries() { return this.currentFileEntries; }
6455

6556
public TreeMap<Integer,Object> getObjectFromNode(EvioNode root){
66-
TreeMap<Integer,Object> treemap = new TreeMap<Integer,Object>();
57+
TreeMap<Integer,Object> treemap = new TreeMap<>();
6758

6859
List<EvioNode> nodes = root.getAllNodes();
6960
for(int loop = 0; loop < nodes.size(); loop++){
@@ -113,9 +104,8 @@ public TreeMap<Integer,Object> getObjectTree(int event){
113104
}
114105

115106
public ArrayList< TreeMap<Integer,Object> > getObjectTree(){
116-
ArrayList< TreeMap<Integer,Object> > objectArray = new ArrayList< TreeMap<Integer,Object> >();
107+
ArrayList< TreeMap<Integer,Object> > objectArray = new ArrayList< >();
117108
for(int loop = 0; loop < currentFileEntries; loop++){
118-
//System.err.println("--- reading file ---");
119109
try {
120110
ByteBuffer evioBuffer = evioReader.getEventBuffer(loop+1, true);
121111
EvioCompactStructureHandler structure = new EvioCompactStructureHandler(evioBuffer,DataType.BANK);
@@ -127,7 +117,7 @@ public ArrayList< TreeMap<Integer,Object> > getObjectTree(){
127117
(node.getDataTypeObj()==DataType.ALSOBANK||
128118
node.getDataTypeObj()==DataType.BANK)){
129119
TreeMap<Integer,Object> objects = this.getObjectFromNode(node);
130-
if(objects.size()>0) objectArray.add(objects);
120+
if(!objects.isEmpty()) objectArray.add(objects);
131121
}
132122
}
133123
} catch (EvioException ex) {
@@ -141,7 +131,7 @@ public void close(){
141131
this.evioReader.close();
142132
}
143133
public ArrayList<Integer> getContainerTags(){
144-
ArrayList<Integer> tags = new ArrayList<Integer>();
134+
ArrayList<Integer> tags = new ArrayList<>();
145135
for(int loop = 0; loop < currentFileEntries; loop++){
146136
try {
147137
ByteBuffer evioBuffer = evioReader.getEventBuffer(loop+1, true);
@@ -152,7 +142,6 @@ public ArrayList<Integer> getContainerTags(){
152142
item.getDataTypeObj()==DataType.BANK||
153143
item.getDataTypeObj()==DataType.ALSOBANK)
154144
tags.add(item.getTag());
155-
//return item;
156145
}
157146
} catch (EvioException ex) {
158147
Logger.getLogger(EvioInputStream.class.getName()).log(Level.SEVERE, null, ex);
@@ -185,10 +174,6 @@ public EvioNode getNodeFromTree(int tag, int num, DataType type){
185174
item.getDataTypeObj()==type)
186175
return item;
187176
}
188-
/*
189-
if(item.getTag()==tag&&item.getNum()==num&&
190-
item.getDataTypeObj()==type)
191-
return item;*/
192177
}
193178
} catch (EvioException ex) {
194179
System.err.println("**** ERROR ***** : error getting node [" + tag
@@ -208,9 +193,9 @@ public byte[] getByte(int tag, int num){
208193
Logger.getLogger(EvioInputStream.class.getName()).log(Level.SEVERE, null, ex);
209194
}
210195
}
211-
//byte[] ret = {0};
212196
return null;
213197
}
198+
214199
public double[] getDouble(int tag, int num){
215200
EvioNode node = this.getNodeFromTree(tag,num,DataType.DOUBLE64);
216201
if(node!=null){
@@ -222,7 +207,6 @@ public double[] getDouble(int tag, int num){
222207
Logger.getLogger(EvioInputStream.class.getName()).log(Level.SEVERE, null, ex);
223208
}
224209
}
225-
//double[] ret = {0.0};
226210
return null;
227211
}
228212

common-tools/clas-io/src/main/java/org/jlab/io/stream/EvioOutputStream.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
/*
2-
* To change this license header, choose License Headers in Project Properties.
3-
* To change this template file, choose Tools | Templates
4-
* and open the template in the editor.
5-
*/
6-
71
package org.jlab.io.stream;
82

93
import java.io.File;

common-tools/clas-io/src/main/java/org/jlab/io/stream/EvioStreamObject.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
/*
2-
* To change this license header, choose License Headers in Project Properties.
3-
* To change this template file, choose Tools | Templates
4-
* and open the template in the editor.
5-
*/
6-
71
package org.jlab.io.stream;
82

93
import java.util.TreeMap;

common-tools/clas-io/src/main/java/org/jlab/io/task/IDataEventListener.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
/*
2-
* To change this license header, choose License Headers in Project Properties.
3-
* To change this template file, choose Tools | Templates
4-
* and open the template in the editor.
5-
*/
6-
71
package org.jlab.io.task;
82

93
import org.jlab.io.base.DataEvent;

common-tools/clas-io/src/main/java/org/jlab/io/ui/BasicDialog.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
/*
2-
* To change this license header, choose License Headers in Project Properties.
3-
* To change this template file, choose Tools | Templates
4-
* and open the template in the editor.
5-
*/
61
package org.jlab.io.ui;
72

8-
93
import java.awt.BorderLayout;
104
import java.awt.Component;
115
import java.awt.Container;

0 commit comments

Comments
 (0)