Package java.io

Examples of java.io.Closeable


        });
        return statement;
    }

    public ResultSet register(final ResultSet resultSet) {
        resources.addFirst(new Closeable() {
           
            @Override
            public void close() throws IOException {
                try {
                    resultSet.close();
View Full Code Here


    @Override
    public synchronized Closeable addObserver(Observer observer) {
        observer.contentChanged(getRoot(), null);

        Closeable closeable = new Closeable() {
            @Override
            public void close() throws IOException {
                synchronized (MemoryNodeStore.this) {
                    observers.remove(this);
                }
View Full Code Here

    @Override
    public Closeable addServerCache(ImmutableBytesPtr cacheId, ImmutableBytesWritable cachePtr, ServerCacheFactory cacheFactory) throws SQLException {
        MemoryChunk chunk = this.getMemoryManager().allocate(cachePtr.getLength());
        boolean success = false;
        try {
            Closeable element = cacheFactory.newCache(cachePtr, chunk);
            getServerCaches().put(cacheId, element);
            success = true;
            return element;
        } finally {
            if (!success) {
View Full Code Here

    }

    @Test
    public void close_success() throws Exception
    {
        Closeable c = newMock(Closeable.class);

        c.close();

        replay();

        InternalUtils.close(c);
View Full Code Here

    }

    @Test
    public void close_ignores_exceptions() throws Exception
    {
        Closeable c = newMock(Closeable.class);

        c.close();
        setThrowable(new IOException());

        replay();

        InternalUtils.close(c);
View Full Code Here

            @Override
            public ExecChannel execChannel(String command) {
               if (command.equals("hostname")) {
                  return new ExecChannel(new ByteArrayOutputStream(), new ByteArrayInputStream(sshHost.getBytes()),
                           new ByteArrayInputStream(new byte[] {}), Suppliers.ofInstance(0), new Closeable() {

                              @Override
                              public void close() {

                              }
View Full Code Here

                     @Override
                     public Integer get() {
                        return output.getExitStatus();
                     }

                  }, new Closeable() {

                     @Override
                     public void close() throws IOException {
                        clear();
                     }
View Full Code Here

       * is resolved.
       */
      TypeToken<ApiContext<? extends Closeable>> contextToken = new TypeToken<ApiContext<? extends Closeable>>() {
         private static final long serialVersionUID = 1L;
      };
      Closeable api = unwrap(contextToken).getApi();
      checkArgument(apiClass.isAssignableFrom(api.getClass()),
            "API type: %s not assignable to %s", api.getClass(), apiClass);
      return apiClass.cast(api);
   }
View Full Code Here

      kp = k + p;
      long omegaSeed = Long.parseLong(context.getConfiguration().get(PROP_OMEGA_SEED));
      omega = new Omega(omegaSeed, k, p);

      outputs = new MultipleOutputs(new JobConf(context.getConfiguration()));
      closeables.addFirst(new Closeable() {
        @Override
        public void close() throws IOException {
          outputs.close();
        }
      });
View Full Code Here

  }

  @Override
  public Closeable preprocessNewThread(Object object) {
    UserContext.setUser((User) object);
    return new Closeable() {
      @Override
      public void close() throws IOException {
        UserContext.reset();
      }
    };
View Full Code Here

TOP

Related Classes of java.io.Closeable

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.