Skip to content

Commit 8dd1985

Browse files
committed
Optimize SimpleDateFormat
1 parent 09ce001 commit 8dd1985

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

projects/com.ibm.cicsdev.link/src/com/ibm/cicsdev/link/LinkServEduchan.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ public class LinkServEduchan
5151
* Name of the container used to return data from this program.
5252
*/
5353
private static final String OUTPUT_CONTAINER = "OUTPUTDATA";
54+
55+
56+
/**
57+
* Time format
58+
*/
59+
private static SimpleDateFormat dfTime = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
5460

5561
/**
5662
* Main entry point to a CICS OSGi program.
@@ -97,9 +103,7 @@ public static void main(String[] args) {
97103
rc = ReturnCode.CONTAINERERR;
98104
}
99105

100-
// Get time for return to caller
101-
SimpleDateFormat dfTime = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
102-
106+
103107
// Build date output container
104108
Container outputCont = chan.createContainer(DATE_CONTAINER);
105109
outputCont.putString( dfTime.format(new Date()) );
@@ -145,7 +149,7 @@ public void buildRcContainer(Channel chan, int rc) {
145149
catch ( InvalidRequestException | ChannelErrorException | CCSIDErrorException |
146150
CodePageErrorException | ContainerErrorException exc) {
147151

148-
// Log the message and throw wrappered to reduce error-handling in this example
152+
// Log the message and throw wrappered exception to reduce error-handling in this example
149153
System.out.println("CICS error from LinkServerEduchan " + exc.getMessage());
150154
throw new RuntimeException(exc);
151155
}

0 commit comments

Comments
 (0)