Package net.grinder.engine.communication

Examples of net.grinder.engine.communication.AgentUpdateGrinderMessage


      }
    });

    messageDispatchRegistry.set(AgentDownloadGrinderMessage.class, new AbstractHandler<AgentDownloadGrinderMessage>() {
      public void handle(final AgentDownloadGrinderMessage message) {
        final AgentUpdateGrinderMessage agentUpdateGrinderMessage = m_agentDownloadListener.onAgentDownloadRequested(message.getVersion(), message.getNext());
        m_consoleCommunication.sendToAddressedAgents(message.getAddress(), agentUpdateGrinderMessage);
      }
    });
  }
View Full Code Here


        } else if (m_agentControllerServerListener.received(AgentControllerServerListener.AGENT_UPDATE)) {
          // Do update agent by downloading new version.
          startMessage = null;
          m_connectionPort = 0;
          m_state = AgentControllerState.UPDATING;
          final AgentUpdateGrinderMessage message = m_agentControllerServerListener.getLastAgentUpdateGrinderMessage();
          m_agentControllerServerListener.discardMessages(AgentControllerServerListener.AGENT_UPDATE);
          AgentDownloadGrinderMessage agentDownloadGrinderMessage = new AgentDownloadGrinderMessage(message.getVersion());
          try {
            // If it's initial message
            if (agentUpdateHandler == null && message.getNext() == 0) {
              IOUtils.closeQuietly(agentUpdateHandler);
              agentUpdateHandler = new AgentUpdateHandler(agentConfig, message);
            } else if (agentUpdateHandler != null) {
              if (message.isValid()) {
                retryCount = 0;
                agentUpdateHandler.update(message);
                agentDownloadGrinderMessage.setNext(message.getNext());
              } else if (retryCount <= AgentDownloadGrinderMessage.MAX_RETRY_COUNT) {
                retryCount++;
                agentDownloadGrinderMessage.setNext(message.getOffset());
              } else {
                throw new CommunicationException("Error while getting the agent package from " +
                    "controller");
              }
            } else {
              throw new CommunicationException("Error while getting the agent package from controller");
            }
            if (consoleCommunication != null) {
              consoleCommunication.sendMessage(agentDownloadGrinderMessage);
            } else {
              break;
            }

          } catch (IllegalArgumentException ex) {
            IOUtils.closeQuietly(agentUpdateHandler);
            agentUpdateHandler = null;
            retryCount = 0;
            LOGGER.info("same or old agent version {} is sent for update. skip this.",
                message.getVersion());
            m_state = AgentControllerState.READY;
          } catch (Exception e) {
            retryCount = 0;
            IOUtils.closeQuietly(agentUpdateHandler);
            agentUpdateHandler = null;
View Full Code Here

      int next = offset + count;
      if (count != updateChunkSize) {
        bytes = Arrays.copyOf(buffer, count);
        next = 0;
      }
      return new AgentUpdateGrinderMessage(version, bytes, offset, next,
          CRC32ChecksumUtils.getCRC32Checksum(bytes));
    } catch (Exception e) {
      LOGGER.error("Error while reading agent package, its offset is {} and details {}:", offset, e);
    } finally {
      IOUtils.closeQuietly(agentPackageReader);
View Full Code Here

TOP

Related Classes of net.grinder.engine.communication.AgentUpdateGrinderMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.