Change PIN Plugin action to Java 8 style
@@ -26,25 +26,17 @@ import iso.std.iso_iec._24727.tech.schema.ActionType;
import iso.std.iso_iec._24727.tech.schema.ConnectionHandleType;
import iso.std.iso_iec._24727.tech.schema.DestroyChannel;
import iso.std.iso_iec._24727.tech.schema.Disconnect;
-import java.util.concurrent.Callable;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
-import java.util.concurrent.ThreadFactory;
-import java.util.logging.Level;
import org.openecard.addon.ActionInitializationException;
import org.openecard.addon.Context;
import org.openecard.addon.bind.AppExtensionException;
-import org.openecard.addon.bind.BindingResult;
-import org.openecard.addon.bind.BindingResultCode;
import org.openecard.common.DynamicContext;
import org.openecard.common.ECardConstants;
-import org.openecard.common.ThreadTerminateException;
-import org.openecard.common.WSHelper;
import org.openecard.common.WSHelper.WSException;
-import org.openecard.common.event.EventObject;
import org.openecard.common.event.EventType;
import org.openecard.common.interfaces.EventCallback;
import org.openecard.common.interfaces.EventFilter;
@@ -101,30 +93,20 @@ public class GetCardsAndPINStatusAction extends AbstractPINAction {
final boolean capturePin = ! nativePace;
try {
- ExecutorService es = Executors.newSingleThreadExecutor(new ThreadFactory() {
- @Override
- public Thread newThread(Runnable action) {
- return new Thread(action, "ShowPINManagementDialog");
- }
- });
+ ExecutorService es = Executors.newSingleThreadExecutor(action -> new Thread(action, "ShowPINManagementDialog"));
- pinManagement = es.submit(new Callable<ResultStatus>() {
- @Override
- public ResultStatus call() throws Exception {
+ pinManagement = es.submit(() -> {
PINDialog uc = new PINDialog(gui, dispatcher, handle , pinState, capturePin);
return uc.show();
- }
});
- disconnectEventSink = new EventCallback() {
- @Override
- public void signalEvent(EventType eventType, EventObject eventData) {
+ disconnectEventSink = (eventType, eventData) -> {
if (eventType == EventType.CARD_REMOVED) {
LOG.info("Card has been removed. Shutting down PIN Management process.");
pinManagement.cancel(true);
}
- }};
+ };
EventFilter evFilter = new CardRemovedFilter(cHandle.getIFDName(), cHandle.getSlotIndex());
evDispatcher.add(disconnectEventSink, evFilter);
