Package net.grinder.console.distribution

Examples of net.grinder.console.distribution.FileDistribution


   *
   * @param listener listener
   * @param safe     safe mode
   */
  public void distributeFiles(ListenerSupport<FileDistributionListener> listener, final boolean safe) {
    final FileDistribution fileDistribution = getConsoleComponent(FileDistribution.class);
    final AgentCacheState agentCacheState = fileDistribution.getAgentCacheState();
    final Condition cacheStateCondition = new Condition();
    agentCacheState.addListener(new PropertyChangeListener() {
      public void propertyChange(PropertyChangeEvent ignored) {
        synchronized (cacheStateCondition) {
          cacheStateCondition.notifyAll();
        }
      }
    });
    final MutableBoolean safeDist = new MutableBoolean(safe);
    ConsoleProperties consoleComponent = getConsoleComponent(ConsoleProperties.class);
    final File file = consoleComponent.getDistributionDirectory().getFile();
    if (listener != null) {
      listener.apply(new Informer<FileDistributionListener>() {
        @Override
        public void inform(FileDistributionListener listener) {
          safeDist.setValue(listener.start(file, safe));
        }
      });
    }
    final FileDistributionHandler distributionHandler = fileDistribution.getHandler();
    // When cancel is called.. stop processing.
    int fileCount = 0;
    while (!cancel) {
      try {
        final FileDistributionHandler.Result result = distributionHandler.sendNextFile();
View Full Code Here

TOP

Related Classes of net.grinder.console.distribution.FileDistribution

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.