Multithread sample
The sample in the threads folder manages credentials with multiple threads.
Compiling Pkcs7ThreadSample.java
Run the following command line in the etjava/examples directory.
javac -sourcepath source -d classes -classpath ../lib/enttoolkit.jar source/com/entrust/toolkit/examples/threads/Pkcs7ThreadSample.javaRunning Pkcs7ThreadSample
Run the following command line in the etjava/examples directory.
java -classpath classes;../lib/enttoolkit.jar com.entrust.toolkit.examples.threads.Pkcs7ThreadSample <epf_file> <epf_pwd> <seconds> [<entrust.ini>]|
Parameter |
Value |
|
<epf_file> |
The path of an Entrust user profile in .epf file format. |
|
<epf_pwd> |
The password for accessing the Entrust profile. |
|
<seconds> |
The execution time, as a number of seconds. |
|
<entrust.ini> |
The path of an Entrust initialization file with .ini extension. |
For example:
c:\etjava\examples>java -classpath classes;..\lib\enttoolkit.jar com.entrust.toolkit.examples.threads.Pkcs7ThreadSample d:\profiles\Java70RootUser1.epf MyPassword 45 d:\profiles\entrust.iniSample to show usage of PKCS7 in multiple threads.Using Entrust identity: d:\profiles\Java70RootUser1.epfWill run threads for approximately 45 secondsUsing entrust.ini file: d:\profiles\entrust.iniLogging inLogged inUser status - 0Status after key management:User status - 0Worker thread 0 runningWorker thread 1 runningWorker thread 2 runningWorker thread 3 runningWorker thread 4 runningStatus after key management:User status - 0Worker thread 0 runningWorker thread 2 runningWorker thread 4 runningWorker thread 1 runningWorker thread 3 runningStatus after key management:User status - 0Worker thread 0 runningWorker thread 2 runningWorker thread 4 runningWorker thread 3 runningWorker thread 1 runningWorker thread 0 runningWorker thread 2 runningWorker thread 4 runningWorker thread 3 runningWorker thread 1 runningStatus after key management:User status - 0Worker thread 0 runningWorker thread 2 runningWorker thread 4 runningWorker thread 3 runningWorker thread 1 runningWorker thread 0 runningWorker thread 2 runningWorker thread 4 runningWorker thread 3 runningWorker thread 1 runningStatus after key management:User status - 0Worker thread 0 runningWorker thread 2 runningWorker thread 4 runningWorker thread 3 runningWorker thread 1 runningWorker thread 0 runningWorker thread 2 runningWorker thread 4 runningWorker thread 3 runningWorker thread 1 runningStatus after key management:User status - 0Worker thread 0 runningWorker thread 2 runningWorker thread 4 runningWorker thread 3 runningWorker thread 1 runningWorker thread 0 runningWorker thread 2 runningWorker thread 4 runningWorker thread 3 runningWorker thread 1 runningStatus after key management:User status - 8193665536 - A Certificate Store Synchronization operation occurred16384 - One or more existing keys/certificates were updated16 - The signing/verification key/certificate was updatedWorker thread 4 runningWorker thread 0 runningWorker thread 2 runningWorker thread 1 runningWorker thread 3 runningWorker thread 4 runningWorker thread 0 runningWorker thread 2 runningWorker thread 1 runningWorker thread 3 runningStatus after key management:User status - 0Additional output cut, the following shows the termination of the program:Worker thread 4 runningWorker thread 0 runningWorker thread 2 runningWorker thread 1 runningWorker thread 3 runningWorker thread 4 runningStopping worker thread 0Stopping worker thread 1Stopping worker thread 2Stopping worker thread 3Stopping worker thread 4Worker thread 0 stopped.Worker thread 2 stopped.Worker thread 1 stopped.Worker thread 3 stopped.Worker thread 4 stopped.Stopping key management threadStatus after key management:User status - 0User management thread stopped.