package net.argius.stew;
import java.util.concurrent.*;
+import java.util.concurrent.atomic.*;
/**
* This is a ThreadFactory which creates threads as a daemon.
public final class DaemonThreadFactory implements ThreadFactory {
private static final Logger log = Logger.getLogger(DaemonThreadFactory.class);
+ private static final AtomicInteger count = new AtomicInteger();
- private static volatile int count;
private static volatile ThreadFactory instance;
private DaemonThreadFactory() {
@Override
public Thread newThread(Runnable r) {
- final String name = String.format("ChildDaemon%d-of-%s", count++, Thread.currentThread());
+ final String name = String.format("ChildDaemon%d-of-%s", count.getAndIncrement(), Thread.currentThread());
if (log.isDebugEnabled()) {
log.debug("create thread: name=" + name);
}
for (final String name : getResourceNames(o)) {
for (final String suffix : suffixes) {
final String key = name + suffix;
- Map<String, String> m = ResourceManager0.map.get(key);
- if (m == null) {
- m = loadResource(key, "u8p", "utf-8");
- if (m == null) {
- continue;
- }
- ResourceManager0.map.putIfAbsent(key, m);
+ Map<String, String> m = (ResourceManager0.map.containsKey(key))
+ ? ResourceManager0.map.get(key)
+ : loadResource(key, "u8p", "utf-8");
+ if (m != null) {
+ ResourceManager0.map.put(key, m);
+ a.add(m);
}
- a.add(m);
}
}
return new ResourceManager(a);
import static javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER;
import static javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS;
import static net.argius.stew.ui.window.AnyActionKey.*;
-
import java.awt.*;
import java.awt.event.*;
import java.beans.*;
import java.util.List;
import java.util.Timer;
import java.util.concurrent.*;
-
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.table.*;
import javax.swing.text.*;
-
import net.argius.stew.*;
import net.argius.stew.ui.*;
statusBar.setForeground(Color.BLUE);
// [Layouts]
/*
- * split2 = ResultSetTable + TextArea
+ * split2 = ResultSetTable + TextArea
* +----------------------------+
* | split2 |
* | +------------------------+ |
final DatabaseInfoTree infoTree = this.infoTree;
final JLabel statusBar = this.statusBar;
final OutputProcessor opref = env.getOutputProcessor();
+ final AnyAction invoker = new AnyAction(this);
try {
doPreProcess();
executorService.execute(new Runnable() {
if (env.getOutputProcessor() == opref) {
time = System.currentTimeMillis() - time;
statusBar.setText(res.get("i.statusbar-message", time / 1000f, cmd));
- AnyAction invoker = new AnyAction(this);
- invoker.doLater("callDoPostProcess");
+ invoker.doLater("doPostProcess");
}
}
- @SuppressWarnings("unused")
- void callDoPostProcess() {
- WindowLauncher.this.doPostProcess();
- }
});
} catch (Exception ex) {
throw new RuntimeException(ex);