@Override public void stopApplication(ApplicationTerminationContext context) { String appId = context.getApplicationId().toString(); try { logger.info("Stopping application {}", appId); if (isAuthenticationEnabled()) { AppId fullId = new AppId(appId); if (db != null) { try { db.delete(dbAppKey(fullId)); } catch (IOException e) { logger.error("Error deleting {} from executor state db", appId, e); } } secretManager.unregisterApp(appId); } blockHandler.applicationRemoved(appId, false /* clean up local dirs */); } catch (Exception e) { logger.error("Exception when stopping application {}", appId, e); } }
@Override public void stopApplication(ApplicationTerminationContext context) { String appId = context.getApplicationId().toString(); try { if (isAuthenticationEnabled()) { AppId fullId = new AppId(appId); if (db != null) { try { db.delete(dbAppKey(fullId)); } catch (IOException e) { logger.error("Error deleting {} from executor state db", appId, e); } } secretManager.unregisterApp(appId); } blockHandler.applicationRemoved(appId, false /* clean up local dirs */); } catch (Exception e) { logger.error("Exception when stopping application {}", appId, e); } }
@Override public void stopApplication(ApplicationTerminationContext context) { String appId = context.getApplicationId().toString(); try { if (isAuthenticationEnabled()) { AppId fullId = new AppId(appId); if (db != null) { try { db.delete(dbAppKey(fullId)); } catch (IOException e) { logger.error("Error deleting {} from executor state db", appId, e); } } secretManager.unregisterApp(appId); } blockHandler.applicationRemoved(appId, false /* clean up local dirs */); } catch (Exception e) { logger.error("Exception when stopping application {}", appId, e); } }
@Test public void testMultipleRegisters() { ShuffleSecretManager secretManager = new ShuffleSecretManager(); secretManager.registerApp(app1, pw1); assertEquals(pw1, secretManager.getSecretKey(app1)); secretManager.registerApp(app2, ByteBuffer.wrap(pw2.getBytes())); assertEquals(pw2, secretManager.getSecretKey(app2)); // now update the password for the apps and make sure it takes affect secretManager.registerApp(app1, pw1update); assertEquals(pw1update, secretManager.getSecretKey(app1)); secretManager.registerApp(app2, ByteBuffer.wrap(pw2update.getBytes())); assertEquals(pw2update, secretManager.getSecretKey(app2)); secretManager.unregisterApp(app1); assertNull(secretManager.getSecretKey(app1)); assertEquals(pw2update, secretManager.getSecretKey(app2)); secretManager.unregisterApp(app2); assertNull(secretManager.getSecretKey(app2)); assertNull(secretManager.getSecretKey(app1)); } }
@Test public void testMultipleRegisters() { ShuffleSecretManager secretManager = new ShuffleSecretManager(); secretManager.registerApp(app1, pw1); assertEquals(pw1, secretManager.getSecretKey(app1)); secretManager.registerApp(app2, ByteBuffer.wrap(pw2.getBytes())); assertEquals(pw2, secretManager.getSecretKey(app2)); // now update the password for the apps and make sure it takes affect secretManager.registerApp(app1, pw1update); assertEquals(pw1update, secretManager.getSecretKey(app1)); secretManager.registerApp(app2, ByteBuffer.wrap(pw2update.getBytes())); assertEquals(pw2update, secretManager.getSecretKey(app2)); secretManager.unregisterApp(app1); assertNull(secretManager.getSecretKey(app1)); assertEquals(pw2update, secretManager.getSecretKey(app2)); secretManager.unregisterApp(app2); assertNull(secretManager.getSecretKey(app2)); assertNull(secretManager.getSecretKey(app1)); } }
@Test public void testMultipleRegisters() { ShuffleSecretManager secretManager = new ShuffleSecretManager(); secretManager.registerApp(app1, pw1); assertEquals(pw1, secretManager.getSecretKey(app1)); secretManager.registerApp(app2, ByteBuffer.wrap(pw2.getBytes())); assertEquals(pw2, secretManager.getSecretKey(app2)); // now update the password for the apps and make sure it takes affect secretManager.registerApp(app1, pw1update); assertEquals(pw1update, secretManager.getSecretKey(app1)); secretManager.registerApp(app2, ByteBuffer.wrap(pw2update.getBytes())); assertEquals(pw2update, secretManager.getSecretKey(app2)); secretManager.unregisterApp(app1); assertNull(secretManager.getSecretKey(app1)); assertEquals(pw2update, secretManager.getSecretKey(app2)); secretManager.unregisterApp(app2); assertNull(secretManager.getSecretKey(app2)); assertNull(secretManager.getSecretKey(app1)); } }