Map<Map<Integer, Venue>,String> uniqueMap = new HashMap<>(); for (Event event: events) { // assuming events is ArrayList Map<Integer, Venue> sessionVenueMap = new HashMap<>(); sessionVenueMap.put(event.getSession(), event.getVenue()); //check if we stored this pair in our cool map if (uniqueMap.get(sessionVenueMap) == null) { //if not //store this in our uniqieMap in our method uniqueMap.put(sessionVenueMap, event.getAct); sessionVenueMap.put(event.getSession(), event.getVenue); } else { // if map has this pair // then it is not unique return false; } venueSessionMap.put(.getVenue(); event.getSession(); } return true;
@Override public void onSessionRemoteOpen(Event event) { open(event.getSession()); }
@Override public void onSessionRemoteOpen(Event event) { open(event.getSession()); }
@Override public void onSessionRemoteClose(Event event) { close(event.getSession()); }
@Override public void onSessionRemoteClose(Event event) { close(event.getSession()); }
@Override public void onSessionLocalClose(Event e) { if (TRACE_LOGGER.isInfoEnabled()) { TRACE_LOGGER.info(String.format(Locale.US, "onSessionLocalClose entityName[%s], condition[%s]", this.entityName, e.getSession().getCondition() == null ? "none" : e.getSession().getCondition().toString())); } }
@Override public void onSessionRemoteOpen(Event e) { TRACE_LOGGER.debug("onSessionRemoteOpen - entityName: {}, sessionIncCapacity: {}, sessionOutgoingWindow: {}", this.name, e.getSession().getIncomingCapacity(), e.getSession().getOutgoingWindow()); Session session = e.getSession(); if (session != null && session.getLocalState() == EndpointState.UNINITIALIZED) { session.open(); } }
@Override public void onSessionLocalClose(Event e) { TRACE_LOGGER.debug("onSessionLocalClose - entityName: {}, condition: {}", this.name, e.getSession().getCondition() == null ? "none" : e.getSession().getCondition().toString()); }
@Override public void onSessionRemoteOpen(Event e) { if (TRACE_LOGGER.isInfoEnabled()) { TRACE_LOGGER.info(String.format(Locale.US, "onSessionRemoteOpen entityName[%s], sessionIncCapacity[%s], sessionOutgoingWindow[%s]", this.entityName, e.getSession().getIncomingCapacity(), e.getSession().getOutgoingWindow())); } final Session session = e.getSession(); if (session != null && session.getLocalState() == EndpointState.UNINITIALIZED) { session.open(); } sessionCreated = true; if (this.onRemoteSessionOpen != null) this.onRemoteSessionOpen.accept(session); }
@Override public void onSessionRemoteClose(Event e) { TRACE_LOGGER.debug("onSessionRemoteClose - entityName: {}, condition: {}", this.name, e.getSession().getCondition() == null ? "none" : e.getSession().getCondition().toString()); Session session = e.getSession(); if (session != null && session.getLocalState() != EndpointState.CLOSED) { session.close(); } }
@Override public void onSessionFinal(Event e) { if (TRACE_LOGGER.isInfoEnabled()) { final Session session = e.getSession(); ErrorCondition condition = session != null ? session.getCondition() : null; TRACE_LOGGER.info(String.format(Locale.US, "onSessionFinal entityName[%s], condition[%s], description[%s]", this.entityName, condition != null ? condition.getCondition() : "n/a", condition != null ? condition.getDescription() : "n/a")); } }
@Override public void onSessionRemoteClose(Event e) { if (TRACE_LOGGER.isInfoEnabled()) { TRACE_LOGGER.info(String.format(Locale.US, "onSessionRemoteClose entityName[%s], condition[%s]", this.entityName, e.getSession().getRemoteCondition() == null ? "none" : e.getSession().getRemoteCondition().toString())); } final Session session = e.getSession(); ErrorCondition condition = session != null ? session.getRemoteCondition() : null; if (session != null && session.getLocalState() != EndpointState.CLOSED) { if (TRACE_LOGGER.isInfoEnabled()) { TRACE_LOGGER.info(String.format(Locale.US, "onSessionRemoteClose closing a local session for entityName[%s], condition[%s], description[%s]", this.entityName, condition != null ? condition.getCondition() : "n/a", condition != null ? condition.getDescription() : "n/a")); } session.setCondition(session.getRemoteCondition()); session.close(); } this.sessionOpenErrorDispatched = true; if (!sessionCreated && this.onRemoteSessionOpenError != null) this.onRemoteSessionOpenError.accept(condition, null); }
if (TRACE_LOGGER.isInfoEnabled()) { TRACE_LOGGER.info(String.format(Locale.US, "onSessionLocalOpen entityName[%s], condition[%s]", this.entityName, e.getSession().getCondition() == null ? "none" : e.getSession().getCondition().toString())); final Session session = e.getSession();
private Handler eventHandler(Event event) { Handler result; if (event.getLink() != null) { result = BaseHandler.getHandler(event.getLink()); if (result != null) return result; } if (event.getSession() != null) { result = BaseHandler.getHandler(event.getSession()); if (result != null) return result; } if (event.getConnection() != null) { result = BaseHandler.getHandler(event.getConnection()); if (result != null) return result; } if (event.getTask() != null) { result = BaseHandler.getHandler(event.getTask()); if (result != null) return result; } if (event.getSelectable() != null) { result = BaseHandler.getHandler(event.getSelectable()); if (result != null) return result; } return handler; }
private Handler eventHandler(Event event) { Handler result; if (event.getLink() != null) { result = BaseHandler.getHandler(event.getLink()); if (result != null) return result; } if (event.getSession() != null) { result = BaseHandler.getHandler(event.getSession()); if (result != null) return result; } if (event.getConnection() != null) { result = BaseHandler.getHandler(event.getConnection()); if (result != null) return result; } if (event.getTask() != null) { result = BaseHandler.getHandler(event.getTask()); if (result != null) return result; } if (event.getSelectable() != null) { result = BaseHandler.getHandler(event.getSelectable()); if (result != null) return result; } return handler; }
private void processEventSessionRemoteState(Event event) { final String methodName = "processEventSessionRemoteState"; logger.entry(this, methodName, event); if (event.getSession().getRemoteState() == EndpointState.ACTIVE) { if (event.getSession().getLocalState() == EndpointState.ACTIVE) { final EngineConnection engineConnection = (EngineConnection) event.getConnection().getContext(); if (!engineConnection.closed) { // First session has opened on the connection OpenRequest req = engineConnection.openRequest; engineConnection.openRequest = null; engineConnection.requestor.tell(new OpenResponse(req, engineConnection), this); } } else { // The remote end is trying to establish a new session with us, which is not allowed. I don't think this is a usual case, // but could occur with a badly written remote end (i.e. sends an initial AMQP open immediately followed by a begin) final Connection protonConnection = event.getConnection(); protonConnection.setCondition(new ErrorCondition(Symbol.getSymbol("mqlight:session-remote-open-rejected"), "MQ Light client is unable to accept an open session request")); protonConnection.close(); } } logger.exit(this, methodName); }
break; case SESSION_INIT: handler.onInit(event.getSession()); break; case SESSION_LOCAL_OPEN: handler.onLocalOpen(event.getSession()); break; case SESSION_REMOTE_OPEN: handler.onRemoteOpen(event.getSession()); break; case SESSION_LOCAL_CLOSE: handler.onLocalClose(event.getSession()); break; case SESSION_REMOTE_CLOSE: handler.onRemoteClose(event.getSession()); break; case SESSION_FINAL: handler.onFinal(event.getSession()); break; case LINK_INIT:
break; case SESSION_REMOTE_OPEN: processSessionOpen(event.getSession()); break; case SESSION_REMOTE_CLOSE: processSessionClose(event.getSession()); break; case LINK_REMOTE_OPEN:
break; case SESSION_REMOTE_OPEN: processSessionOpen(event.getSession()); break; case SESSION_REMOTE_CLOSE: processSessionClose(event.getSession()); break; case LINK_REMOTE_OPEN:
break; case SESSION_REMOTE_CLOSE: amqpEventSink = (AmqpEventSink) protonEvent.getSession().getContext(); amqpEventSink.processRemoteClose(this); break; case SESSION_REMOTE_OPEN: amqpEventSink = (AmqpEventSink) protonEvent.getSession().getContext(); amqpEventSink.processRemoteOpen(this); break;