use of iso.std.iso_iec._24727.tech.schema.ReleaseContext in project open-ecard by ecsec.
the class IFD method releaseContext.
@Override
public synchronized ReleaseContextResponse releaseContext(ReleaseContext parameters) {
ReleaseContextResponse response;
if (ByteUtils.compare(ctxHandle, parameters.getContextHandle())) {
if (numClients.decrementAndGet() == 0) {
// last client detaches
env.removeIFDCtx(ctxHandle);
ctxHandle = null;
numClients = null;
// terminate thread pool
// wait for threads to die and block new requests
threadPool.shutdownNow();
// just assume it worked ... and don't wait
threadPool = null;
asyncWaitThreads = null;
}
evManager.terminate();
response = WSHelper.makeResponse(ReleaseContextResponse.class, WSHelper.makeResultOK());
return response;
} else {
String msg = "Invalid context handle specified.";
Result r = WSHelper.makeResultError(ECardConstants.Minor.IFD.INVALID_CONTEXT_HANDLE, msg);
response = WSHelper.makeResponse(ReleaseContextResponse.class, r);
return response;
}
}
use of iso.std.iso_iec._24727.tech.schema.ReleaseContext in project open-ecard by ecsec.
the class TerminalTest method kill.
@AfterTest
public void kill() {
if (ifd != null) {
ReleaseContext rCtx = new ReleaseContext();
rCtx.setContextHandle(ctxHandle);
ifd.releaseContext(rCtx);
}
ifd = null;
}
use of iso.std.iso_iec._24727.tech.schema.ReleaseContext in project open-ecard by ecsec.
the class RichClient method teardown.
public void teardown() {
try {
if (eventDispatcher != null) {
eventDispatcher.terminate();
}
// TODO: shutdown addon manager and related components?
if (manager != null) {
manager.shutdown();
}
// shutdown control modules
if (httpBinding != null) {
httpBinding.stop();
}
// shutdown SAL
if (sal != null) {
Terminate terminate = new Terminate();
sal.terminate(terminate);
}
// shutdown IFD
if (ifd != null && contextHandle != null) {
ReleaseContext releaseContext = new ReleaseContext();
releaseContext.setContextHandle(contextHandle);
ifd.releaseContext(releaseContext);
}
} catch (Exception ex) {
LOG.error("Failed to stop Richclient.", ex);
}
System.exit(0);
}
use of iso.std.iso_iec._24727.tech.schema.ReleaseContext in project open-ecard by ecsec.
the class OpeneCardContext method shutdown.
String shutdown() {
initialized = false;
try {
if (ifd != null && contextHandle != null) {
ReleaseContext releaseContext = new ReleaseContext();
releaseContext.setContextHandle(contextHandle);
ifd.releaseContext(releaseContext);
}
if (eventDispatcher != null) {
eventDispatcher.terminate();
}
if (manager != null) {
manager.shutdown();
}
if (sal != null) {
Terminate terminate = new Terminate();
sal.terminate(terminate);
}
return SUCCESS;
} catch (Exception ex) {
LOG.error("Failed to terminate Open eCard instances...", ex);
return FAILURE;
}
}
Aggregations