コード例 #1
0
ファイル: GroupByHash.java プロジェクト: Ravion/Presto-1
 public int hashCode(int position) {
   int result = 0;
   for (ChannelBuilder channel : channels) {
     result = addToHashCode(result, channel.hashCode(position));
   }
   return result;
 }
コード例 #2
0
ファイル: GroupByHash.java プロジェクト: Ravion/Presto-1
 public long getMemorySize() {
   long memorySize = 0;
   for (ChannelBuilder channel : channels) {
     memorySize += channel.getMemorySize();
   }
   return memorySize;
 }
コード例 #3
0
ファイル: GroupByHash.java プロジェクト: Ravion/Presto-1
 public boolean equals(int position, BlockCursor... row) {
   for (int i = 0; i < channels.size(); i++) {
     ChannelBuilder thisBlock = this.channels.get(i);
     if (!thisBlock.equals(position, row[i])) {
       return false;
     }
   }
   return true;
 }
コード例 #4
0
ファイル: GroupByHash.java プロジェクト: Ravion/Presto-1
 public boolean equals(int thisPosition, GroupByPageBuilder that, int thatPosition) {
   for (int i = 0; i < channels.size(); i++) {
     ChannelBuilder thisBlock = this.channels.get(i);
     ChannelBuilder thatBlock = that.channels.get(i);
     if (!thisBlock.equals(thisPosition, thatBlock, thatPosition)) {
       return false;
     }
   }
   return true;
 }
コード例 #5
0
ファイル: Channel.java プロジェクト: kbrowder/remoting
  /*package*/ Channel(ChannelBuilder settings, CommandTransport transport) throws IOException {
    this.name = settings.getName();
    this.executor = new InterceptingExecutorService(settings.getExecutors());
    this.isRestricted = settings.isRestricted();
    this.underlyingOutput = transport.getUnderlyingStream();
    this.jarCache = settings.getJarCache();

    this.baseClassLoader = settings.getBaseLoader();

    if (export(this, false) != 1)
      throw new AssertionError(); // export number 1 is reserved for the channel itself
    remoteChannel = RemoteInvocationHandler.wrap(this, 1, IChannel.class, true, false);

    this.remoteCapability = transport.getRemoteCapability();
    this.pipeWriter = new PipeWriter(createPipeWriterExecutor());

    this.transport = transport;

    this.jarLoader =
        new JarLoaderImpl(); // TODO: figure out a mechanism to allow the user to share this across
    // Channels
    setProperty(JarLoader.OURS, export(JarLoader.class, jarLoader, false));

    transport.setup(
        this,
        new CommandReceiver() {
          public void handle(Command cmd) {
            lastHeard = System.currentTimeMillis();
            if (logger.isLoggable(Level.FINE)) logger.fine("Received " + cmd);
            try {
              cmd.execute(Channel.this);
            } catch (Throwable t) {
              logger.log(
                  Level.SEVERE,
                  "Failed to execute command " + cmd + " (channel " + Channel.this.name + ")",
                  t);
              logger.log(Level.SEVERE, "This command is created here", cmd.createdAt);
            }
          }

          public void terminate(IOException e) {
            Channel.this.terminate(e);
          }
        });
  }
コード例 #6
0
ファイル: Channel.java プロジェクト: kbrowder/remoting
 /*package*/ Channel(ChannelBuilder settings, InputStream is, OutputStream os) throws IOException {
   this(settings, settings.negotiate(is, os));
 }
コード例 #7
0
ファイル: GroupByHash.java プロジェクト: Ravion/Presto-1
 public void appendValuesTo(int position, BlockBuilder[] builders) {
   for (int i = 0; i < channels.size(); i++) {
     ChannelBuilder channel = channels.get(i);
     channel.appendTo(position, builders[i]);
   }
 }