@Test public void testAssociate() throws Exception { TestPirasoRequest request = mockPirasoRequest("test", "a1"); User user = registry.createOrGetUser(request); ResponseLoggerService service = mockService(request.getRemoteAddr(), true); registry.associate(user, service); assertEquals(1, registry.getContextPreferences(request).size()); assertEquals(1, registry.getContextLoggers(request).size()); assertTrue(registry.isUserExist(user)); }
public void associate(User user, ResponseLoggerService service) throws IOException { lock.lock(); try { if(LOG.isInfoEnabled() && user != null) { LOG.info(String.format( "[PIRASO USER]: User ASSOCIATED with address '%s' and activity id '%s'.", user.getRemoteAddr(), user.getActivityUuid()) ); } stopServiceIfExist(user); service.addStopListener(new StoppedLoggerHandler()); userLoggerMap.put(user, service); } finally { lock.unlock(); } }
DefaultUserRegistryImpl implements UserRegistry { public void associate(User user, ResponseLoggerService service) throws IOException { lock.lock(); try { if(LOG.isInfoEnabled() && user != null) { LOG.info(String.format( "[PIRASO USER]: User ASSOCIATED with address '%s' and activity id '%s'.", user.getRemoteAddr(), user.getActivityUuid()) ); } stopServiceIfExist(user); service.addStopListener(new StoppedLoggerHandler()); userLoggerMap.put(user, service); } finally { lock.unlock(); } } }
DefaultUserRegistryImpl implements UserRegistry { public void associate(User user, ResponseLoggerService service) throws IOException { lock.lock(); try { if(LOG.isInfoEnabled() && user != null) { LOG.info(String.format( "[PIRASO USER]: User ASSOCIATED with address '%s' and activity id '%s'.", user.getRemoteAddr(), user.getActivityUuid()) ); } stopServiceIfExist(user); service.addStopListener(new StoppedLoggerHandler()); userLoggerMap.put(user, service); } finally { lock.unlock(); } }  }
DefaultUserRegistryImpl implements UserRegistry { public void associate(User user, ResponseLoggerService service) throws IOException { lock.lock(); try { if(LOG.isInfoEnabled() && user != null) { LOG.info(String.format( "[PIRASO USER]: User ASSOCIATED with address '%s' and activity id '%s'.", user.getRemoteAddr(), user.getActivityUuid()) ); } stopServiceIfExist(user); service.addStopListener(new StoppedLoggerHandler()); userLoggerMap.put(user, service); } finally { lock.unlock(); } }  List<Preferences> getContextPreferences(PirasoEntryPoint entryPoint); Map<User, ResponseLoggerService> getUserLoggerMap(); List<ResponseLoggerService> getContextLoggers(PirasoEntryPoint request); void clear(); boolean isWatched(PirasoEntryPoint request); boolean isUserExist(User user); User createOrGetUser(PirasoRequest request); ResponseLoggerService getLogger(User user); void associate(User user, ResponseLoggerService service); void removeUser(User user); }
DefaultUserRegistryImpl implements UserRegistry { public void associate(User user, ResponseLoggerService service) throws IOException { lock.lock(); try { if(LOG.isInfoEnabled() && user != null) { LOG.info(String.format( "[PIRASO USER]: User ASSOCIATED with address '%s' and activity id '%s'.", user.getRemoteAddr(), user.getActivityUuid()) ); } stopServiceIfExist(user); service.addStopListener(new StoppedLoggerHandler()); userLoggerMap.put(user, service); } finally { lock.unlock(); } }  List<Preferences> getContextPreferences(PirasoEntryPoint entryPoint); Map<User, ResponseLoggerService> getUserLoggerMap(); List<ResponseLoggerService> getContextLoggers(PirasoEntryPoint request); void clear(); boolean isWatched(PirasoEntryPoint request); boolean isUserExist(User user); User createOrGetUser(PirasoRequest request); ResponseLoggerService getLogger(User user); void associate(User user, ResponseLoggerService service); void removeUser(User user);  }