Patch from Dave to excise all remaining tabs.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2759 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -95,8 +95,7 @@ class FieldDescriptor
|
|||||||
pstmt.setDouble(column,((Double)field.get(obj)).doubleValue());
|
pstmt.setDouble(column,((Double)field.get(obj)).doubleValue());
|
||||||
break;
|
break;
|
||||||
case tBoolean:
|
case tBoolean:
|
||||||
pstmt.setBoolean(column,
|
pstmt.setBoolean(column, ((Boolean)field.get(obj)).booleanValue());
|
||||||
((Boolean)field.get(obj)).booleanValue());
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case tDecimal:
|
case tDecimal:
|
||||||
@@ -133,10 +132,8 @@ class FieldDescriptor
|
|||||||
case tClosure:
|
case tClosure:
|
||||||
// There is no reason to use piped streams because
|
// There is no reason to use piped streams because
|
||||||
// we need to pass total number of bytes to JDBC driver
|
// we need to pass total number of bytes to JDBC driver
|
||||||
java.io.ByteArrayOutputStream out =
|
java.io.ByteArrayOutputStream out = new java.io.ByteArrayOutputStream();
|
||||||
new java.io.ByteArrayOutputStream();
|
java.io.ObjectOutputStream clu = new java.io.ObjectOutputStream(out);
|
||||||
java.io.ObjectOutputStream clu =
|
|
||||||
new java.io.ObjectOutputStream(out);
|
|
||||||
clu.writeObject(field.get(obj));
|
clu.writeObject(field.get(obj));
|
||||||
clu.close();
|
clu.close();
|
||||||
pstmt.setBytes(column, out.toByteArray());
|
pstmt.setBytes(column, out.toByteArray());
|
||||||
@@ -160,8 +157,7 @@ class FieldDescriptor
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final boolean updateVariable (
|
protected final boolean updateVariable (ResultSet result, Object obj, int column)
|
||||||
ResultSet result, Object obj, int column)
|
|
||||||
throws SQLException
|
throws SQLException
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@@ -192,8 +188,7 @@ class FieldDescriptor
|
|||||||
result.updateByte(column, ((Byte)field.get(obj)).byteValue());
|
result.updateByte(column, ((Byte)field.get(obj)).byteValue());
|
||||||
break;
|
break;
|
||||||
case tShort:
|
case tShort:
|
||||||
result.updateShort(column,
|
result.updateShort(column, ((Short)field.get(obj)).shortValue());
|
||||||
((Short)field.get(obj)).shortValue());
|
|
||||||
break;
|
break;
|
||||||
case tInteger:
|
case tInteger:
|
||||||
result.updateInt(column, ((Integer)field.get(obj)).intValue());
|
result.updateInt(column, ((Integer)field.get(obj)).intValue());
|
||||||
@@ -202,16 +197,13 @@ class FieldDescriptor
|
|||||||
result.updateLong(column, ((Long)field.get(obj)).longValue());
|
result.updateLong(column, ((Long)field.get(obj)).longValue());
|
||||||
break;
|
break;
|
||||||
case tFloat:
|
case tFloat:
|
||||||
result.updateFloat(column,
|
result.updateFloat(column, ((Float)field.get(obj)).floatValue());
|
||||||
((Float)field.get(obj)).floatValue());
|
|
||||||
break;
|
break;
|
||||||
case tDouble:
|
case tDouble:
|
||||||
result.updateDouble(column,
|
result.updateDouble(column, ((Double)field.get(obj)).doubleValue());
|
||||||
((Double)field.get(obj)).doubleValue());
|
|
||||||
break;
|
break;
|
||||||
case tBoolean:
|
case tBoolean:
|
||||||
result.updateBoolean(column,
|
result.updateBoolean(column, ((Boolean)field.get(obj)).booleanValue());
|
||||||
((Boolean)field.get(obj)).booleanValue());
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case tDecimal:
|
case tDecimal:
|
||||||
@@ -230,8 +222,7 @@ class FieldDescriptor
|
|||||||
result.updateTime(column, (java.sql.Time)field.get(obj));
|
result.updateTime(column, (java.sql.Time)field.get(obj));
|
||||||
break;
|
break;
|
||||||
case tTimestamp:
|
case tTimestamp:
|
||||||
result.updateTimestamp(column,
|
result.updateTimestamp(column, (java.sql.Timestamp)field.get(obj));
|
||||||
(java.sql.Timestamp)field.get(obj));
|
|
||||||
break;
|
break;
|
||||||
case tStream:
|
case tStream:
|
||||||
java.io.InputStream in = (java.io.InputStream)field.get(obj);
|
java.io.InputStream in = (java.io.InputStream)field.get(obj);
|
||||||
@@ -239,15 +230,11 @@ class FieldDescriptor
|
|||||||
break;
|
break;
|
||||||
case tBlob:
|
case tBlob:
|
||||||
Blob blob = (Blob)field.get(obj);
|
Blob blob = (Blob)field.get(obj);
|
||||||
result.updateBinaryStream(column,
|
result.updateBinaryStream(column, blob.getBinaryStream(), (int)blob.length());
|
||||||
blob.getBinaryStream(),
|
|
||||||
(int)blob.length());
|
|
||||||
break;
|
break;
|
||||||
case tClob:
|
case tClob:
|
||||||
Clob clob = (Clob)field.get(obj);
|
Clob clob = (Clob)field.get(obj);
|
||||||
result.updateCharacterStream(column,
|
result.updateCharacterStream(column, clob.getCharacterStream(), (int)clob.length());
|
||||||
clob.getCharacterStream(),
|
|
||||||
(int)clob.length());
|
|
||||||
break;
|
break;
|
||||||
case tAsString:
|
case tAsString:
|
||||||
result.updateString(column, field.get(obj).toString());
|
result.updateString(column, field.get(obj).toString());
|
||||||
@@ -255,10 +242,8 @@ class FieldDescriptor
|
|||||||
case tClosure:
|
case tClosure:
|
||||||
// There is no reason to use piped streams because
|
// There is no reason to use piped streams because
|
||||||
// we need to pass total number of bytes to JDBC driver
|
// we need to pass total number of bytes to JDBC driver
|
||||||
java.io.ByteArrayOutputStream out =
|
java.io.ByteArrayOutputStream out = new java.io.ByteArrayOutputStream();
|
||||||
new java.io.ByteArrayOutputStream();
|
java.io.ObjectOutputStream clu = new java.io.ObjectOutputStream(out);
|
||||||
java.io.ObjectOutputStream clu =
|
|
||||||
new java.io.ObjectOutputStream(out);
|
|
||||||
clu.writeObject(field.get(obj));
|
clu.writeObject(field.get(obj));
|
||||||
clu.close();
|
clu.close();
|
||||||
result.updateBytes(column, out.toByteArray());
|
result.updateBytes(column, out.toByteArray());
|
||||||
@@ -369,8 +354,7 @@ class FieldDescriptor
|
|||||||
case tClosure:
|
case tClosure:
|
||||||
try {
|
try {
|
||||||
java.io.InputStream input = result.getBinaryStream(column);
|
java.io.InputStream input = result.getBinaryStream(column);
|
||||||
java.io.ObjectInputStream in =
|
java.io.ObjectInputStream in = new java.io.ObjectInputStream(input);
|
||||||
new java.io.ObjectInputStream(input);
|
|
||||||
field.set(obj, in.readObject());
|
field.set(obj, in.readObject());
|
||||||
in.close();
|
in.close();
|
||||||
} catch(ClassNotFoundException ex) {
|
} catch(ClassNotFoundException ex) {
|
||||||
|
|||||||
@@ -60,8 +60,7 @@ public class CDDBTest
|
|||||||
}
|
}
|
||||||
System.out.println("Extended data: " + detail.extendedData);
|
System.out.println("Extended data: " + detail.extendedData);
|
||||||
for (int i = 0; i < detail.extendedTrackData.length; i++) {
|
for (int i = 0; i < detail.extendedTrackData.length; i++) {
|
||||||
System.out.println(pad(i) + ": " +
|
System.out.println(pad(i) + ": " + detail.extendedTrackData[i]);
|
||||||
detail.extendedTrackData[i]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,8 +85,7 @@ public class CDDBTest
|
|||||||
test(args[0], "1b037b03");
|
test(args[0], "1b037b03");
|
||||||
|
|
||||||
} catch (CDDBException ce) {
|
} catch (CDDBException ce) {
|
||||||
System.err.println("Protocol exception: " + ce.getCode() +
|
System.err.println("Protocol exception: " + ce.getCode() + ": " + ce.getMessage());
|
||||||
": " + ce.getMessage());
|
|
||||||
|
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
t.printStackTrace(System.err);
|
t.printStackTrace(System.err);
|
||||||
|
|||||||
@@ -48,24 +48,21 @@ public abstract class GroupLayout
|
|||||||
* Constructs a new constraints object with the specified weight,
|
* Constructs a new constraints object with the specified weight,
|
||||||
* which is only applicable with the STRETCH policy.
|
* which is only applicable with the STRETCH policy.
|
||||||
*/
|
*/
|
||||||
public Constraints (int weight)
|
public Constraints (int weight) {
|
||||||
{
|
|
||||||
_weight = weight;
|
_weight = weight;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is this Constraints specifying fixed?
|
* Is this Constraints specifying fixed?
|
||||||
*/
|
*/
|
||||||
public final boolean isFixed ()
|
public final boolean isFixed () {
|
||||||
{
|
|
||||||
return (this == FIXED);
|
return (this == FIXED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the weight.
|
* Get the weight.
|
||||||
*/
|
*/
|
||||||
public final int getWeight ()
|
public final int getWeight () {
|
||||||
{
|
|
||||||
return _weight;
|
return _weight;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,9 +194,8 @@ public abstract class GroupLayout
|
|||||||
_constraints.put(comp, (Constraints)constraints);
|
_constraints.put(comp, (Constraints)constraints);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw new RuntimeException("GroupLayout constraints " +
|
throw new RuntimeException(
|
||||||
"object must be of type " +
|
"GroupLayout constraints object must be of type GroupLayout.Constraints");
|
||||||
"GroupLayout.Constraints");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -261,8 +257,7 @@ public abstract class GroupLayout
|
|||||||
* Computes dimensions of the children widgets that are useful for the
|
* Computes dimensions of the children widgets that are useful for the
|
||||||
* group layout managers.
|
* group layout managers.
|
||||||
*/
|
*/
|
||||||
protected DimenInfo computeDimens (Container parent, int type)
|
protected DimenInfo computeDimens (Container parent, int type) {
|
||||||
{
|
|
||||||
int count = parent.getComponentCount();
|
int count = parent.getComponentCount();
|
||||||
DimenInfo info = new DimenInfo();
|
DimenInfo info = new DimenInfo();
|
||||||
info.dimens = new Dimension[count];
|
info.dimens = new Dimension[count];
|
||||||
|
|||||||
@@ -46,10 +46,8 @@ public class GroupLayoutTest
|
|||||||
JButton butthree = new JButton("Three to get ready");
|
JButton butthree = new JButton("Three to get ready");
|
||||||
panel.add(butthree, GroupLayout.FIXED);
|
panel.add(butthree, GroupLayout.FIXED);
|
||||||
|
|
||||||
frame.addWindowListener(new WindowAdapter ()
|
frame.addWindowListener(new WindowAdapter () {
|
||||||
{
|
@Override public void windowClosing (WindowEvent e) {
|
||||||
@Override public void windowClosing (WindowEvent e)
|
|
||||||
{
|
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -24,8 +24,7 @@ import java.awt.*;
|
|||||||
|
|
||||||
public class HGroupLayout extends GroupLayout
|
public class HGroupLayout extends GroupLayout
|
||||||
{
|
{
|
||||||
public HGroupLayout (Policy policy, Policy offpolicy, int gap,
|
public HGroupLayout (Policy policy, Policy offpolicy, int gap, Justification justification)
|
||||||
Justification justification)
|
|
||||||
{
|
{
|
||||||
_policy = policy;
|
_policy = policy;
|
||||||
_offpolicy = offpolicy;
|
_offpolicy = offpolicy;
|
||||||
@@ -62,8 +61,7 @@ public class HGroupLayout extends GroupLayout
|
|||||||
Dimension dims = new Dimension();
|
Dimension dims = new Dimension();
|
||||||
|
|
||||||
if (_policy == STRETCH) {
|
if (_policy == STRETCH) {
|
||||||
dims.width = info.maxfreewid * (info.count - info.numfix) +
|
dims.width = info.maxfreewid * (info.count - info.numfix) + info.fixwid;
|
||||||
info.fixwid;
|
|
||||||
} else if (_policy == EQUALIZE) {
|
} else if (_policy == EQUALIZE) {
|
||||||
dims.width = info.maxwid * info.count;
|
dims.width = info.maxwid * info.count;
|
||||||
} else { // NONE or CONSTRAIN
|
} else { // NONE or CONSTRAIN
|
||||||
@@ -153,8 +151,7 @@ public class HGroupLayout extends GroupLayout
|
|||||||
if (_policy == NONE || c.isFixed()) {
|
if (_policy == NONE || c.isFixed()) {
|
||||||
newwid = info.dimens[i].width;
|
newwid = info.dimens[i].width;
|
||||||
} else {
|
} else {
|
||||||
newwid = freefrac +
|
newwid = freefrac + ((_policy == STRETCH) ? defwid * c.getWeight() : defwid);
|
||||||
((_policy == STRETCH) ? defwid * c.getWeight() : defwid);
|
|
||||||
// clear out the extra pixels the first time they're used
|
// clear out the extra pixels the first time they're used
|
||||||
freefrac = 0;
|
freefrac = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,8 +24,7 @@ import java.awt.*;
|
|||||||
|
|
||||||
public class VGroupLayout extends GroupLayout
|
public class VGroupLayout extends GroupLayout
|
||||||
{
|
{
|
||||||
public VGroupLayout (Policy policy, Policy offpolicy, int gap,
|
public VGroupLayout (Policy policy, Policy offpolicy, int gap, Justification justification)
|
||||||
Justification justification)
|
|
||||||
{
|
{
|
||||||
_policy = policy;
|
_policy = policy;
|
||||||
_offpolicy = offpolicy;
|
_offpolicy = offpolicy;
|
||||||
@@ -62,8 +61,7 @@ public class VGroupLayout extends GroupLayout
|
|||||||
Dimension dims = new Dimension();
|
Dimension dims = new Dimension();
|
||||||
|
|
||||||
if (_policy == STRETCH) {
|
if (_policy == STRETCH) {
|
||||||
dims.height = info.maxfreehei * (info.count - info.numfix) +
|
dims.height = info.maxfreehei * (info.count - info.numfix) + info.fixhei;
|
||||||
info.fixhei;
|
|
||||||
} else if (_policy == EQUALIZE) {
|
} else if (_policy == EQUALIZE) {
|
||||||
dims.height = info.maxhei * info.count;
|
dims.height = info.maxhei * info.count;
|
||||||
} else { // NONE or CONSTRAIN
|
} else { // NONE or CONSTRAIN
|
||||||
@@ -153,8 +151,7 @@ public class VGroupLayout extends GroupLayout
|
|||||||
if (_policy == NONE || c.isFixed()) {
|
if (_policy == NONE || c.isFixed()) {
|
||||||
newhei = info.dimens[i].height;
|
newhei = info.dimens[i].height;
|
||||||
} else {
|
} else {
|
||||||
newhei = freefrac +
|
newhei = freefrac + ((_policy == STRETCH) ? defhei * c.getWeight() : defhei);
|
||||||
((_policy == STRETCH) ? defhei * c.getWeight() : defhei);
|
|
||||||
// clear out the extra pixels the first time they're used
|
// clear out the extra pixels the first time they're used
|
||||||
freefrac = 0;
|
freefrac = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,16 +127,13 @@ public class MenuUtil
|
|||||||
* @param name the item name.
|
* @param name the item name.
|
||||||
* @param mnem the mnemonic key for the item.
|
* @param mnem the mnemonic key for the item.
|
||||||
* @param accel the keystroke for the item or null if none.
|
* @param accel the keystroke for the item or null if none.
|
||||||
* @param target the object on which to invoke a method when the menu
|
* @param target the object on which to invoke a method when the menu is selected.
|
||||||
* is selected.
|
* @param callbackName the name of the method to invoke when the menu is selected.
|
||||||
* @param callbackName the name of the method to invoke when the menu
|
|
||||||
* is selected.
|
|
||||||
*
|
*
|
||||||
* @return the new menu item.
|
* @return the new menu item.
|
||||||
*/
|
*/
|
||||||
public static JMenuItem addMenuItem (
|
public static JMenuItem addMenuItem (
|
||||||
JMenu menu, String name, int mnem, KeyStroke accel,
|
JMenu menu, String name, int mnem, KeyStroke accel, Object target, String callbackName)
|
||||||
Object target, String callbackName)
|
|
||||||
{
|
{
|
||||||
JMenuItem item = createItem(name, Integer.valueOf(mnem), accel);
|
JMenuItem item = createItem(name, Integer.valueOf(mnem), accel);
|
||||||
item.addActionListener(new ReflectedAction(target, callbackName));
|
item.addActionListener(new ReflectedAction(target, callbackName));
|
||||||
@@ -152,10 +149,8 @@ public class MenuUtil
|
|||||||
*
|
*
|
||||||
* @param menu the menu to add the item to.
|
* @param menu the menu to add the item to.
|
||||||
* @param name the item name.
|
* @param name the item name.
|
||||||
* @param target the object on which to invoke a method when the menu
|
* @param target the object on which to invoke a method when the menu is selected.
|
||||||
* is selected.
|
* @param callbackName the name of the method to invoke when the menu is selected.
|
||||||
* @param callbackName the name of the method to invoke when the menu
|
|
||||||
* is selected.
|
|
||||||
*
|
*
|
||||||
* @return the new menu item.
|
* @return the new menu item.
|
||||||
*/
|
*/
|
||||||
@@ -181,10 +176,8 @@ public class MenuUtil
|
|||||||
*
|
*
|
||||||
* @param menu the menu to add the item to.
|
* @param menu the menu to add the item to.
|
||||||
* @param name the item name.
|
* @param name the item name.
|
||||||
* @param target the object on which to invoke a method when the menu
|
* @param target the object on which to invoke a method when the menu is selected.
|
||||||
* is selected.
|
* @param callbackName the name of the method to invoke when the menu is selected.
|
||||||
* @param callbackName the name of the method to invoke when the menu
|
|
||||||
* is selected.
|
|
||||||
*
|
*
|
||||||
* @return the new menu item.
|
* @return the new menu item.
|
||||||
*/
|
*/
|
||||||
@@ -200,8 +193,7 @@ public class MenuUtil
|
|||||||
/**
|
/**
|
||||||
* Creates and configures a menu item.
|
* Creates and configures a menu item.
|
||||||
*/
|
*/
|
||||||
protected static JMenuItem createItem (
|
protected static JMenuItem createItem (String name, Integer mnem, KeyStroke accel)
|
||||||
String name, Integer mnem, KeyStroke accel)
|
|
||||||
{
|
{
|
||||||
JMenuItem item = new JMenuItem(name);
|
JMenuItem item = new JMenuItem(name);
|
||||||
if (mnem != null) {
|
if (mnem != null) {
|
||||||
@@ -218,8 +210,7 @@ public class MenuUtil
|
|||||||
*/
|
*/
|
||||||
protected static class ReflectedAction implements ActionListener
|
protected static class ReflectedAction implements ActionListener
|
||||||
{
|
{
|
||||||
public ReflectedAction (Object target, String methodName)
|
public ReflectedAction (Object target, String methodName) {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
// look up the method we'll be calling
|
// look up the method we'll be calling
|
||||||
_method = target.getClass().getMethod(methodName, METHOD_ARGS);
|
_method = target.getClass().getMethod(methodName, METHOD_ARGS);
|
||||||
@@ -231,8 +222,7 @@ public class MenuUtil
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void actionPerformed (ActionEvent event)
|
public void actionPerformed (ActionEvent event) {
|
||||||
{
|
|
||||||
if (_method != null) {
|
if (_method != null) {
|
||||||
try {
|
try {
|
||||||
_method.invoke(_target, new Object[] { event });
|
_method.invoke(_target, new Object[] { event });
|
||||||
|
|||||||
@@ -231,9 +231,8 @@ public class ProximityTracker
|
|||||||
*/
|
*/
|
||||||
protected int binarySearch (int x)
|
protected int binarySearch (int x)
|
||||||
{
|
{
|
||||||
// copied from java.util.Arrays which I wouldn't have to have done
|
// copied from java.util.Arrays which I wouldn't have to have done had the provided a
|
||||||
// had the provided a means by which to binarySearch in a subset
|
// means by which to binarySearch in a subset of an array. alas.
|
||||||
// of an array. alas.
|
|
||||||
int low = 0;
|
int low = 0;
|
||||||
int high = _size-1;
|
int high = _size-1;
|
||||||
|
|
||||||
|
|||||||
@@ -47,8 +47,7 @@ public class TaskMaster
|
|||||||
* subsequent dealings with the task master. The supplied observer (if
|
* subsequent dealings with the task master. The supplied observer (if
|
||||||
* non-null) will be notified when the task has completed.
|
* non-null) will be notified when the task has completed.
|
||||||
*/
|
*/
|
||||||
public static void invokeTask (String name, Task task,
|
public static void invokeTask (String name, Task task, TaskObserver observer)
|
||||||
TaskObserver observer)
|
|
||||||
{
|
{
|
||||||
// create a task runner and stick it in our task table
|
// create a task runner and stick it in our task table
|
||||||
TaskRunner runner = new TaskRunner(name, task, observer);
|
TaskRunner runner = new TaskRunner(name, task, observer);
|
||||||
@@ -65,8 +64,7 @@ public class TaskMaster
|
|||||||
* <code>invoke</code> method of the <code>Task</code> interface.
|
* <code>invoke</code> method of the <code>Task</code> interface.
|
||||||
* Aborting tasks run in this way is not supported.
|
* Aborting tasks run in this way is not supported.
|
||||||
*/
|
*/
|
||||||
public static void invokeMethodTask (String name, Object source,
|
public static void invokeMethodTask (String name, Object source, TaskObserver observer)
|
||||||
TaskObserver observer)
|
|
||||||
{
|
{
|
||||||
// create a method task instance to invoke the named method and
|
// create a method task instance to invoke the named method and
|
||||||
// then run that through the normal task invocation mechanism
|
// then run that through the normal task invocation mechanism
|
||||||
@@ -84,8 +82,7 @@ public class TaskMaster
|
|||||||
|
|
||||||
protected static class TaskRunner extends Thread
|
protected static class TaskRunner extends Thread
|
||||||
{
|
{
|
||||||
public TaskRunner (String name, Task task, TaskObserver observer)
|
public TaskRunner (String name, Task task, TaskObserver observer) {
|
||||||
{
|
|
||||||
_name = name;
|
_name = name;
|
||||||
_task = task;
|
_task = task;
|
||||||
_observer = observer;
|
_observer = observer;
|
||||||
@@ -93,15 +90,12 @@ public class TaskMaster
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invokes the task and then reports completion or failure later
|
* Invokes the task and then reports completion or failure later on the swing event
|
||||||
* on the swing event dispatcher thread. We need to ensure that
|
* dispatcher thread. We need to ensure that _mode and _result are visible to the various
|
||||||
* _mode and _result are visible to the various threads that
|
* threads that invoke this runnable so run() is synchronized. Oh how I love Chapter 17.
|
||||||
* invoke this runnable so run() is synchronized. Oh how I love
|
|
||||||
* Chapter 17.
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public synchronized void run ()
|
public synchronized void run () {
|
||||||
{
|
|
||||||
switch (_mode) {
|
switch (_mode) {
|
||||||
default:
|
default:
|
||||||
case INVOKE:
|
case INVOKE:
|
||||||
@@ -141,8 +135,7 @@ public class TaskMaster
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void abort ()
|
public void abort () {
|
||||||
{
|
|
||||||
log.warning("abort() not currently supported.");
|
log.warning("abort() not currently supported.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,22 +153,19 @@ public class TaskMaster
|
|||||||
|
|
||||||
protected static class MethodTask implements Task
|
protected static class MethodTask implements Task
|
||||||
{
|
{
|
||||||
public MethodTask (String name, Object source)
|
public MethodTask (String name, Object source) {
|
||||||
{
|
|
||||||
_name = name;
|
_name = name;
|
||||||
_source = source;
|
_source = source;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object invoke () throws Exception
|
public Object invoke () throws Exception {
|
||||||
{
|
|
||||||
// look up the named method on the source object and invoke it
|
// look up the named method on the source object and invoke it
|
||||||
Method meth = _source.getClass().getMethod(_name, (Class<?>[]) null);
|
Method meth = _source.getClass().getMethod(_name, (Class<?>[]) null);
|
||||||
meth.setAccessible(true);
|
meth.setAccessible(true);
|
||||||
return meth.invoke(_source, (Object[]) null);
|
return meth.invoke(_source, (Object[]) null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean abort ()
|
public boolean abort () {
|
||||||
{
|
|
||||||
// aborting not supported
|
// aborting not supported
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -184,6 +174,5 @@ public class TaskMaster
|
|||||||
protected Object _source;
|
protected Object _source;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static Hashtable<String,TaskRunner> _tasks =
|
protected static Hashtable<String, TaskRunner> _tasks = new Hashtable<String, TaskRunner>();
|
||||||
new Hashtable<String,TaskRunner>();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,8 +90,7 @@ public class ConfigUtil
|
|||||||
* Like {@link #loadProperties(String,ClassLoader)} but the properties are loaded into the
|
* Like {@link #loadProperties(String,ClassLoader)} but the properties are loaded into the
|
||||||
* supplied {@link Properties} object.
|
* supplied {@link Properties} object.
|
||||||
*/
|
*/
|
||||||
public static void loadProperties (
|
public static void loadProperties (String path, ClassLoader loader, Properties target)
|
||||||
String path, ClassLoader loader, Properties target)
|
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
InputStream in = getStream(path, loader);
|
InputStream in = getStream(path, loader);
|
||||||
|
|||||||
@@ -449,8 +449,7 @@ public class IntIntMap
|
|||||||
public int key;
|
public int key;
|
||||||
public int value;
|
public int value;
|
||||||
|
|
||||||
public Record (int key, int value)
|
public Record (int key, int value) {
|
||||||
{
|
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -176,8 +176,7 @@ public class Queue<T>
|
|||||||
if (_count == 0) {
|
if (_count == 0) {
|
||||||
try { wait(maxwait); } catch (InterruptedException e) {}
|
try { wait(maxwait); } catch (InterruptedException e) {}
|
||||||
|
|
||||||
// if count's still null when we pull out, we waited
|
// if count's still null when we pull out, we waited ourmaxwait time.
|
||||||
// ourmaxwait time.
|
|
||||||
if (_count == 0) {
|
if (_count == 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user