Search in sources :

Example 1 with ReleaseContextResponse

use of iso.std.iso_iec._24727.tech.schema.ReleaseContextResponse 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;
    }
}
Also used : ReleaseContextResponse(iso.std.iso_iec._24727.tech.schema.ReleaseContextResponse) Result(oasis.names.tc.dss._1_0.core.schema.Result)

Aggregations

ReleaseContextResponse (iso.std.iso_iec._24727.tech.schema.ReleaseContextResponse)1 Result (oasis.names.tc.dss._1_0.core.schema.Result)1