@SuppressWarnings("unchecked") protected <T, U extends UserInterface<T>> U newUi(Class<? extends T> type, Class<? super U> uiType) { if (uiType == null) { throw new NullPointerException("Must specify UI type for "+type); } try { return (U) uiType.newInstance(); } catch (InstantiationException | IllegalAccessException e) { X_Log.error(getClass(), "Unable to instantiate",uiType, e); throw X_Debug.rethrow(e); } }
/** * Always returns false. * @return always false */ public boolean isDebugEnabled() { return X_Log.loggable(LogLevel.DEBUG); }
@Override public final void onEnd() { X_Log.trace(getClass(),"ending", this); try { for (LineReader delegate : delegates.forEach()) { X_Log.debug(getClass(),"ending delegate", delegate.getClass(), delegate); delegate.onEnd(); } } finally { finished = true; onEnd0(); } synchronized (delegates) { delegates.notifyAll(); } }
private static void rm(String kill, boolean recursive) { File f = new File(kill); if (recursive) { HashSet<File> cycle = new HashSet<File>(); rmRecursive(f, cycle); } if (f.exists() && !f.delete()) { X_Log.warn(FileServiceImpl.class, "Unable to delete file ",f); } }
final ConvertsValue<Object, Object> converter, final String prefix, final int depth) { if (depth > MAX_DEPTH) { X_Log.warn(getClass(), "Recursion sickness detected in "+cls+" from "+prefix+"; depth reached "+MAX_DEPTH); if (X_Log.loggable(LogLevel.TRACE)) { X_Log.trace("Consider using the @DoNotIndex annotation in the recursion chain produced by "+prefix);
@SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void run() { final boolean log = info != null && X_Log.loggable(info), trace = X_Log.loggable(LogLevel.TRACE); int delay = 20; int read = 1; X_Log.debug(getClass(), "Stream not alive; bailing after ",X_Time.difference(birth)); read = -1; break top; X_Log.log(info, new SimpleFifo<Object>().give(getClass()) .give("before read") .give(X_Time.difference(birth)) X_Log.log(info, new SimpleFifo<Object>().give(getClass()) .give("after read") .give(X_Time.difference(birth)) if (log){ final String asStr = new String(buffer.toByteArray(), "UTF-8"); X_Log.log(info, new SimpleFifo<Object>().give(getClass()).give(asStr)); X_Log.debug(getClass(), "read returned -1"); break top; X_Log.error(getClass(), "Error draining input stream", info, in, e); } finally { X_Log.debug(getClass(), "Finished blocking", this); successHandler.onEnd();
@Override public void run() { try { if (file.exists()) { file.delete(); } final FileOutputStream result = new FileOutputStream(file); X_IO.drain(result, X_IO.toStreamUtf8(serialized.toString())); callback.onSuccess(model); X_Log.info(getClass(), "Saved model to ",file); } catch (final IOException e) { X_Log.error(getClass(), "Unable to save model "+model, e); if (callback instanceof ErrorHandler) { ((ErrorHandler) callback).onError(e); } } } });
private static void touch(Package java) { X_Log.info(java); }
@Override public ArtifactResult loadArtifact(String groupId, String artifactId, String classifier, String extension, String version) { Moment before = X_Time.now(); RepositorySystem repoSystem = this.repoSystem.get(); RepositorySystemSession session = this.session.get(); DefaultArtifact artifact = new DefaultArtifact( groupId,artifactId,classifier, X_String.isEmpty(extension) ? "jar" : extension, version); try { ArtifactRequest request = new ArtifactRequest(artifact, remoteRepos(), null); return repoSystem.resolveArtifact(session, request); } catch (ArtifactResolutionException e) { X_Log.log(getClass(), getLogLevel(), "Resolved? ", e.getResult().isResolved(), e.getResult().getExceptions()); X_Log.log(getClass(), getLogLevel(), "Could not download " + artifact, e); throw X_Debug.rethrow(e); } finally { if (X_Log.loggable(LogLevel.DEBUG)) { X_Log.debug("Resolved: " + artifact.toString() + " in " + X_Time.difference(before)); } } }
public static ClasspathResourceMap compileScopeScanner(MavenProject project, MavenSession session) { URL[] urls = compileScopeUrls(project, session); X_Log.trace(X_Maven.class,"Compile scope URLS",urls); return X_Scanner.scanClassloader(URLClassLoader.newInstance(urls)); }
@Override public LocalArtifactResult loadLocalArtifact(String groupId, String artifactId, String classifier, String extension, String version) { Moment before = X_Time.now(); RepositorySystemSession session = this.session.get(); DefaultArtifact artifact = new DefaultArtifact( groupId,artifactId,classifier, X_String.isEmpty(extension) ? "jar" : extension, version); try { LocalArtifactRequest request = new LocalArtifactRequest(artifact, null, null); return session.getLocalRepositoryManager().find(session, request); } finally { if (X_Log.loggable(LogLevel.DEBUG)) { X_Log.debug("Resolved: " + artifact.toString() + " in " + X_Time.difference(before)); } } }
@Override protected ConcurrentEnvironment initialize(Thread key, UncaughtExceptionHandler params) { if (key.getState() == State.TERMINATED) { //send an exception... params.uncaughtException(key, new ThreadDeath()); } if (key.isInterrupted()) { params.uncaughtException(key, new InterruptedException()); } X_Log.debug("Initializing Concurrent Environment", key); return initializeEnvironment(key, params); } @Override
private static void rmRecursive(File f, HashSet<File> cycle) { if (cycle.add(f)) { if (f.isDirectory()) { for (File child : f.listFiles()) { rmRecursive(child, cycle); // Prevent symlink cycle recursion } if (!f.delete()) { X_Log.warn(FileServiceImpl.class,"Unable to delete",f); } } else if (f.isFile()) { if (!f.delete()) { X_Log.warn(FileServiceImpl.class,"Unable to delete",f); } } } }
final ConvertsValue<Object, Object> converter, String prefix, int depth) { if (depth > MAX_DEPTH) { X_Log.warn(getClass(), "Recursion sickness detected in "+cls+" from "+prefix+"; depth reached "+MAX_DEPTH); if (X_Log.loggable(LogLevel.TRACE)) { X_Log.trace("Consider using the @DoNotIndex annotation in the recursion chain produced by "+prefix);