Examples of Closeable


Examples of ch.njol.util.Closeable

    if (databases == null || !(databases instanceof SectionNode)) {
      Skript.error("The config is missing the required 'databases' section that defines where the variables are saved");
      return false;
    }
   
    Skript.closeOnDisable(new Closeable() {
      @Override
      public void close() {
        Variables.close();
      }
    });
View Full Code Here

Examples of com.googlecode.objectify.util.Closeable

    final Objectify ofy = factory.begin();

    stack.add(ofy);

    return new Closeable() {
      @Override
      public void close() {
        if (stack.isEmpty())
          throw new IllegalStateException("You have already destroyed the Objectify context.");
View Full Code Here

Examples of com.mycila.testing.core.util.Closeable

    @Override
    protected final Object createTest() throws Exception {
        Object test = super.createTest();
        testNotifier = MycilaTesting.from(test.getClass()).configure(test).createNotifier(test);
        ShutdownHook.get().add(new Closeable() {
            public void close() throws Exception {
                testNotifier.shutdown();
            }
        });
        testNotifier.prepare();
View Full Code Here

Examples of io.vertx.core.impl.Closeable

  }

  @Test
  public void testCloseHooksCalled() throws Exception {
    AtomicInteger closedCount = new AtomicInteger();
    Closeable myCloseable1 = completionHandler -> {
      closedCount.incrementAndGet();
      completionHandler.handle(Future.completedFuture());
    };
    Closeable myCloseable2 = completionHandler -> {
      closedCount.incrementAndGet();
      completionHandler.handle(Future.completedFuture());
    };
    MyAsyncVerticle verticle = new MyAsyncVerticle(f-> {
      ContextImpl ctx = (ContextImpl)vertx.context();
View Full Code Here

Examples of java.io.Closeable

   public void testClose()
   {
      assertFalse(Safe.close(null));
      assertTrue(Safe.close(new ByteArrayOutputStream()));
      assertFalse(Safe.close(new Closeable()
      {
         public void close() throws IOException
         {
            throw new IOException();
         }
      }));
      assertFalse(Safe.close(new Closeable()
      {
         public void close() throws IOException
         {
            throw new RuntimeException();
         }
      }));
      final Error expectedError = new Error();
      try
      {
         Safe.close(new Closeable()
         {
            public void close() throws IOException
            {
               throw expectedError;
            }
View Full Code Here

Examples of java.io.Closeable

      VirtualFile backupRoot = VFS.getChild("/profileservice/originals/");
     
      for (Map.Entry<String, URI> entry : namedURIMap.entrySet())
      {
         VirtualFile backup = backupRoot.getChild(profileName).getChild("roots").getChild(entry.getKey());
         Closeable closeable =  mountRepositoryRoot(entry.getValue(), backup);
         vfCache.put(entry.getKey(), backup);
         mounts.put(entry.getKey(), closeable);
      }
   }
View Full Code Here

Examples of java.io.Closeable

   VirtualFile backup(String profileName, String name, VirtualFile original) throws IOException
   {
      File realFile = original.getPhysicalFile();
      String hash = Integer.toHexString(realFile.toURI().hashCode());
      VirtualFile backup = originals.getChild(profileName).getChild(hash + realFile.getName());
      Closeable closeable = VFS.mountReal(realFile, backup);
      mounts.put(name, closeable);
      return backup;
   }
View Full Code Here

Examples of java.io.Closeable

    * @param name
    * @throws IOException
    */
   void cleanup(String name) throws IOException
   {
      Closeable closeable = mounts.remove(name);
      if(closeable != null)
      {
         closeable.close();
      }
   }
View Full Code Here

Examples of java.io.Closeable

      extensionSwapClient = new ExtensionSwapClient(websiteHostname, windowContext, userPreferences);
    }
    ExtensionSwapInstallationHttpContainer container = new ExtensionSwapInstallationHttpContainer(extensionSwapClient,
        userPreferences);

    final Closeable closeableConnection = container.initialize();
    if (closeableConnection != null) {
      windowContext.addExitActionListener(new ExitActionListener() {
        @Override
        public void exit(int statusCode) {
          FileHelper.safeClose(closeableConnection);
View Full Code Here

Examples of java.io.Closeable

        return valuesList;
    }

    public static void close(InputSource is) {
        Closeable c = is.getByteStream();
        if (c == null) {
            c = is.getCharacterStream();
        }
        if (c != null) {
            try {
                c.close();
            } catch (IOException e) {
                // Ignore
            }
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.