@@ -0,0 +1,1392 @@
+/*%0A * The Alluxio Open Foundation licenses this work under the Apache License, version 2.0%0A * (the %22License%22). You may not use this work except in compliance with the License, which is%0A * available at www.apache.org/licenses/LICENSE-2.0%0A *%0A * This software is distributed on an %22AS IS%22 basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,%0A * either express or implied, as more fully set forth in the License.%0A *%0A * See the NOTICE file distributed with this work for information regarding copyright ownership.%0A */%0A%0Apackage alluxio.worker.netty;%0A%0Aimport alluxio.network.protocol.databuffer.DataBuffer;%0Aimport io.netty.channel.ChannelFuture;%0Aimport io.netty.channel.ChannelFutureListener;%0A%0Aimport javax.annotation.concurrent.ThreadSafe;%0A%0A/**%0A * A listener that will release the given resource when the operation completes. This class accepts%0A * null resources.%0A */%0A@ThreadSafe%0Afinal class ReleasableResourceChannelListener implements ChannelFutureListener %7B%0A  private final DataBuffer mResource;%0A%0A  /**%0A   * Creates a new instance of %7B@link alluxio.worker.netty.ReleasableResourceChannelListener%7D.%0A   *%0A   * @param resource the resource to close%0A   */%0A  ReleasableResourceChannelListener(DataBuffer resource) %7B%0A    mResource = resource;%0A  %7D%0A%0A  @Override%0A  public void operationComplete(ChannelFuture future) throws Exception %7B%0A    if (mResource != null) %7B%0A      mResource.release();%0A    %7D%0A  %7D%0A%7D%0A

Add a releasable resource channel listener.