Returns a runnable that, when run, removes the file system with the given URI from this
provider.
8357
@SuppressWarnings("unused") // called via reflection
  public static Runnable removeFileSystemRunnable(final URI uri) {
    return new Runnable() {
      @Override
      public void run() {
        fileSystems.remove(uri);
      }
    };
  }
120611
public static Action0 fromRunnable(Runnable run, Worker inner) {
        if (run == null) {
            throw new NullPointerException("run");
        }
        return new ActionWrappingRunnable(run, inner);
    }
279825
public ClusterNode getRunnableNode(RequestedNode requestedNode,
                                     LocalityLevel maxLevel,
                                     ResourceType type,
                                     Set<String> excluded) {
    ClusterNode node = null;
    RunnableIndices r = typeToIndices.get(type);

    // find host local
    node = r.getRunnableNodeForHost(requestedNode);

    if (maxLevel == LocalityLevel.NODE || node != null) {
      return node;
    }
    node = r.getRunnableNodeForRack(requestedNode, excluded);

    if (maxLevel == LocalityLevel.RACK || node != null) {
      return node;
    }

    // find any node
    node = r.getRunnableNodeForAny(excluded);

    return node;
  }
318299
public static <E extends Throwable> @NonNull Runnable rethrowRunnable(final @NonNull ThrowingRunnable<E> runnable) {
    return runnable;
  }
550755
public Path download(URI src) {
    try {
      return paths.get(src);
    } catch (ExecutionException e) {
      throw new RuntimeException(e);
    }
  }
827140
public static <S extends ScopeType<S>> FileSystem get(URI uri, Configuration configuration, SharedResourcesBroker<S> broker)
    throws IOException {
    try {
      return broker.getSharedResource(new FileSystemFactory<S>(), new FileSystemKey(uri, configuration));
    } catch (NotConfiguredException nce) {
      throw new IOException(nce);
    }
  }
310384
public static synchronized Runnable performRuntimeAttachment() {
		if (runtimeAttached || !corePlugin.isStagemonitorActive() || !corePlugin.isAttachAgentAtRuntime()) {
			return NOOP_ON_SHUTDOWN_ACTION;
		}
		runtimeAttached = true;

		final List<ClassFileTransformer> classFileTransformers = new ArrayList<ClassFileTransformer>();
		final AutoEvictingCachingBinaryLocator binaryLocator = new AutoEvictingCachingBinaryLocator();
		if (assertNoDifferentStagemonitorVersionIsDeployedOnSameJvm() && initInstrumentation()) {
			final long start = System.currentTimeMillis();
			classFileTransformers.add(initByteBuddyClassFileTransformer(binaryLocator));
			if (corePlugin.isDebugInstrumentation()) {
				logger.info("Attached agents in {} ms", System.currentTimeMillis() - start);
			}
			TimedElementMatcherDecorator.logMetrics();
		}
		return new Runnable() {
			public void run() {
				for (ClassFileTransformer classFileTransformer : classFileTransformers) {
					instrumentation.removeTransformer(classFileTransformer);
				}
				// This ClassLoader is shutting down so don't try to retransform classes of it in the future
				hashCodesOfClassLoadersToIgnore.add(ClassUtils.getIdentityString(AgentAttacher.class.getClassLoader()));
				binaryLocator.close();
			}
		};
	}
943229
def _local_run(self, run_conf):
        '''
        
        '''
        try:
            ret = self._get_runner(run_conf).run()
        except SystemExit:
            ret = 'Runner is not available at this moment'
            self.out.error(ret)
        except Exception as ex:
            ret = 'Unhandled exception occurred: {}'.format(ex)
            log.debug(ex, exc_info=True)

        return ret
767428
public static Optional<Long> timedRun(Runnable runnable) {
    long t0 = System.currentTimeMillis();
    runnable.run();
    return Optional.of(System.currentTimeMillis() - t0);
  }
1090970
def delete(self, uri, force=False, timeout=-1, custom_headers=None):
        
        if force:
            uri += '?force=True'

        logger.debug("Delete resource (uri = %s)" % (str(uri)))

        task, body = self._connection.delete(uri, custom_headers=custom_headers)

        if not task:
            # 204 NO CONTENT
            # Successful return from a synchronous delete operation.
            return True

        task = self._task_monitor.wait_for_task(task, timeout=timeout)

        return task
416648
public Runnable asRunnable() {
        return new Runnable() {
            @Override
            public void run() {
                try {
                    callable.call();
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            }
        };
    }
855124
def remove_uri(self, image):
        '''
        '''
        image = image or ''
        uri = self.get_uri(image) or ''
        image = image.replace('%s://' %uri,'', 1)
        return image.strip('-').rstrip('/')
906547
@Trivial
    private static URI getURI(final File file) {
        return AccessController.doPrivileged( new PrivilegedAction<URI>() {
            @Override
            public URI run() {
                return file.toURI();
            }
        } );
    }
64247
def delete_file(self, uri, purge=False):
        
        try:
            resource = self.get_resource_by_uri(uri)
        except ResourceNotFoundError:
            # Nothing to remove
            return None

        if not isinstance(resource, File):
            raise ValueError("File expected, got {}".format(type(resource)))

        if purge:
            func = self.api.file_purge
        else:
            func = self.api.file_delete

        return func(resource['quickkey'])
58069
public static Thread go(Runnable runnable) {
        Thread thread = daemonThreadFrom(runnable);
        thread.start();
        return thread;
    }
921426
Drawable getDrawableFromResourceUri(Uri uri) throws FileNotFoundException {
        String authority = uri.getAuthority();
        Resources r;
        if (TextUtils.isEmpty(authority)) {
            throw new FileNotFoundException("No authority: " + uri);
        } else {
            try {
                r = mContext.getPackageManager().getResourcesForApplication(authority);
            } catch (NameNotFoundException ex) {
                throw new FileNotFoundException("No package found for authority: " + uri);
            }
        }
        List<String> path = uri.getPathSegments();
        if (path == null) {
            throw new FileNotFoundException("No path: " + uri);
        }
        int len = path.size();
        int id;
        if (len == 1) {
            try {
                id = Integer.parseInt(path.get(0));
            } catch (NumberFormatException e) {
                throw new FileNotFoundException("Single path segment is not a resource ID: " + uri);
            }
        } else if (len == 2) {
            id = r.getIdentifier(path.get(1), path.get(0), authority);
        } else {
            throw new FileNotFoundException("More than two path segments: " + uri);
        }
        if (id == 0) {
            throw new FileNotFoundException("No resource found for: " + uri);
        }
        return r.getDrawable(id);
    }
610205
@SuppressWarnings("unchecked")
  public final E remove()
  {
    Thread thread = Thread.currentThread();
    ClassLoader loader = thread.getContextClassLoader();

    for (; loader != null; loader = loader.getParent()) {
      if (loader instanceof EnvironmentClassLoader) {
        EnvironmentClassLoader envLoader = (EnvironmentClassLoader) loader;

        return (E) envLoader.removeAttribute(_varName);
      }
    }

    return setGlobal(null);
  }