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.java

Running 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.ini
 
Sample to show usage of PKCS7 in multiple threads.
Using Entrust identity: d:\profiles\Java70RootUser1.epf
Will run threads for approximately 45 seconds
Using entrust.ini file: d:\profiles\entrust.ini
Logging in
Logged in
User status - 0
 
Status after key management:
User status - 0
 
Worker thread 0 running
Worker thread 1 running
Worker thread 2 running
Worker thread 3 running
Worker thread 4 running
Status after key management:
User status - 0
 
Worker thread 0 running
Worker thread 2 running
Worker thread 4 running
Worker thread 1 running
Worker thread 3 running
Status after key management:
User status - 0
 
Worker thread 0 running
Worker thread 2 running
Worker thread 4 running
Worker thread 3 running
Worker thread 1 running
Worker thread 0 running
Worker thread 2 running
Worker thread 4 running
Worker thread 3 running
Worker thread 1 running
Status after key management:
User status - 0
 
Worker thread 0 running
Worker thread 2 running
Worker thread 4 running
Worker thread 3 running
Worker thread 1 running
Worker thread 0 running
Worker thread 2 running
Worker thread 4 running
Worker thread 3 running
Worker thread 1 running
Status after key management:
User status - 0
 
Worker thread 0 running
Worker thread 2 running
Worker thread 4 running
Worker thread 3 running
Worker thread 1 running
Worker thread 0 running
Worker thread 2 running
Worker thread 4 running
Worker thread 3 running
Worker thread 1 running
Status after key management:
User status - 0
 
Worker thread 0 running
Worker thread 2 running
Worker thread 4 running
Worker thread 3 running
Worker thread 1 running
Worker thread 0 running
Worker thread 2 running
Worker thread 4 running
Worker thread 3 running
Worker thread 1 running
Status after key management:
User status - 81936
65536 - A Certificate Store Synchronization operation occurred
16384 - One or more existing keys/certificates were updated
16 - The signing/verification key/certificate was updated
 
Worker thread 4 running
Worker thread 0 running
Worker thread 2 running
Worker thread 1 running
Worker thread 3 running
Worker thread 4 running
Worker thread 0 running
Worker thread 2 running
Worker thread 1 running
Worker thread 3 running
Status after key management:
User status - 0
 
Additional output cut, the following shows the termination of the program:
 
Worker thread 4 running
Worker thread 0 running
Worker thread 2 running
Worker thread 1 running
Worker thread 3 running
Worker thread 4 running
Stopping worker thread 0
Stopping worker thread 1
Stopping worker thread 2
Stopping worker thread 3
Stopping worker thread 4
Worker thread 0 stopped.
Worker thread 2 stopped.
Worker thread 1 stopped.
Worker thread 3 stopped.
Worker thread 4 stopped.
Stopping key management thread
Status after key management:
User status - 0
 
User management thread stopped.