Skip to content

Commit

Permalink
minor reformat - no code change
Browse files Browse the repository at this point in the history
  • Loading branch information
ar committed Sep 5, 2012
1 parent c32b196 commit 29f2a03
Showing 1 changed file with 22 additions and 24 deletions.
46 changes: 22 additions & 24 deletions jpos/src/main/java/org/jpos/iso/BaseChannel.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public BaseChannel () {
name = "";
incomingFilters = new Vector();
outgoingFilters = new Vector();
setHost (null, 0);
setHost(null, 0);
}

/**
Expand Down Expand Up @@ -807,7 +807,7 @@ public String getOriginalRealm() {
*/
public void setName (String name) {
this.name = name;
NameRegistrar.register ("channel."+name, this);
NameRegistrar.register("channel." + name, this);
}
/**
* @return this ISOChannel's name ("" if no name was set)
Expand Down Expand Up @@ -838,13 +838,13 @@ public void addFilter (ISOFilter filter, int direction) {
* @param filter incoming filter to add
*/
public void addIncomingFilter (ISOFilter filter) {
addFilter (filter, ISOMsg.INCOMING);
addFilter(filter, ISOMsg.INCOMING);
}
/**
* @param filter outgoing filter to add
*/
public void addOutgoingFilter (ISOFilter filter) {
addFilter (filter, ISOMsg.OUTGOING);
addFilter(filter, ISOMsg.OUTGOING);
}

/**
Expand Down Expand Up @@ -881,7 +881,7 @@ public void removeFilter (ISOFilter filter) {
* @param filter incoming filter to remove
*/
public void removeIncomingFilter (ISOFilter filter) {
removeFilter (filter, ISOMsg.INCOMING);
removeFilter(filter, ISOMsg.INCOMING);
}
/**
* @param filter outgoing filter to remove
Expand Down Expand Up @@ -1062,24 +1062,22 @@ private boolean isSoLingerForcingImmediateTcpReset() {
return soLingerOn && soLingerSeconds == 0;
}
public Object clone(){
try {
BaseChannel channel = (BaseChannel)super.clone();
channel.cnt = cnt.clone();
// The lock objects must also be cloned, and the DataStreams nullified, as it makes no sense
// to use the new lock objects to protect the old DataStreams.
// This should be safe as the only code that calls BaseChannel.clone() is ISOServer.run(),
// and it immediately calls accept(ServerSocket) which does a connect(), and that sets the stream objects.
channel.serverInLock = new Object();
channel.serverOutLock = new Object();
channel.serverIn = null;
channel.serverOut = null;
channel.usable = false;
channel.socket = null;
return channel;
} catch (CloneNotSupportedException e) {
throw new InternalError();
}

try {
BaseChannel channel = (BaseChannel) super.clone();
channel.cnt = cnt.clone();
// The lock objects must also be cloned, and the DataStreams nullified, as it makes no sense
// to use the new lock objects to protect the old DataStreams.
// This should be safe as the only code that calls BaseChannel.clone() is ISOServer.run(),
// and it immediately calls accept(ServerSocket) which does a connect(), and that sets the stream objects.
channel.serverInLock = new Object();
channel.serverOutLock = new Object();
channel.serverIn = null;
channel.serverOut = null;
channel.usable = false;
channel.socket = null;
return channel;
} catch (CloneNotSupportedException e) {
throw new InternalError();
}
}
}

0 comments on commit 29f2a03

Please sign in to comment.