[Jsxe-cvs] SF.net SVN: jsxe: [1081] branches/jsxe2/src/net/sourceforge/jsxe/util
Status: Inactive
Brought to you by:
ian_lewis
|
From: <ian...@us...> - 2006-07-28 20:04:49
|
Revision: 1081 Author: ian_lewis Date: 2006-07-28 13:04:32 -0700 (Fri, 28 Jul 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1081&view=rev Log Message: ----------- Added WorkThread classes Modified Paths: -------------- branches/jsxe2/src/net/sourceforge/jsxe/dom2/ls/XMLDocumentIORequest.java Added Paths: ----------- branches/jsxe2/src/net/sourceforge/jsxe/util/WorkRequest.java branches/jsxe2/src/net/sourceforge/jsxe/util/WorkThread.java branches/jsxe2/src/net/sourceforge/jsxe/util/WorkThreadPool.java branches/jsxe2/src/net/sourceforge/jsxe/util/WorkThreadProgressListener.java Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/ls/XMLDocumentIORequest.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/ls/XMLDocumentIORequest.java 2006-07-28 20:03:36 UTC (rev 1080) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/ls/XMLDocumentIORequest.java 2006-07-28 20:04:32 UTC (rev 1081) @@ -60,7 +60,7 @@ /** * Buffer boolean property set when an error occurs. */ - public static final String ERROR_OCCURRED = "BufferIORequest__error"; + public static final String ERROR_OCCURRED = "XMLDocumentIORequest__error"; /** * A file load request. @@ -105,12 +105,12 @@ * Creates a new buffer I/O request. * @param type The request type * @param view The view - * @param buffer The buffer + * @param buffer The document * @param session The VFS session * @param vfs The VFS * @param path The path */ - public XMLDocumentIORequest(int type, View view, Buffer buffer, + public XMLDocumentIORequest(int type, TabbedView view, XMLDocument buffer, Object session, VFS vfs, String path) { this.type = type; @@ -126,44 +126,42 @@ } //}}} //{{{ run() method - public void run() - { - switch(type) - { - case LOAD: - load(); - break; - case SAVE: - save(); - break; - case AUTOSAVE: - autosave(); - break; - case INSERT: - insert(); - break; - default: - throw new InternalError(); + public void run() { + + switch(type) { + case LOAD: + load(); + break; + case SAVE: + save(); + break; + case AUTOSAVE: + autosave(); + break; + case INSERT: + insert(); + break; + default: + throw new InternalError(); } } //}}} //{{{ toString() method - public String toString() - { + public String toString() { + String typeString; - switch(type) - { - case LOAD: - typeString = "LOAD"; - break; - case SAVE: - typeString = "SAVE"; - break; - case AUTOSAVE: - typeString = "AUTOSAVE"; - break; - default: - typeString = "UNKNOWN!!!"; + switch(type) { + case LOAD: + typeString = "LOAD"; + break; + case SAVE: + typeString = "SAVE"; + break; + case AUTOSAVE: + typeString = "AUTOSAVE"; + break; + default: + typeString = "UNKNOWN!!!"; } return getClass().getName() + "[type=" + typeString @@ -183,18 +181,17 @@ //}}} //{{{ load() method - private void load() - { + private void load() { + InputStream in = null; - try - { - try - { + try { + try { + String[] args = { vfs.getFileName(path) }; setAbortable(true); - if(!buffer.isTemporary()) - { + + if (!buffer.isTemporary()) { setStatus(jEdit.getProperty("vfs.status.load",args)); setProgressValue(0); } @@ -204,103 +201,83 @@ VFS.DirectoryEntry entry = vfs._getDirectoryEntry( session,path,view); long length; - if(entry != null) + if (entry != null) { length = entry.length; - else + } else { length = 0L; + } - in = vfs._createInputStream(session,path, - false,view); - if(in == null) + in = vfs._createInputStream(session,path,false,view); + if (in == null) { return; + } read(autodetect(in),length,false); buffer.setNewFile(false); - } - catch(CharConversionException ch) - { + } catch(CharConversionException ch) { Log.log(Log.ERROR,this,ch); Object[] pp = { buffer.getProperty(Buffer.ENCODING), ch.toString() }; VFSManager.error(view,path,"ioerror.encoding-error",pp); buffer.setBooleanProperty(ERROR_OCCURRED,true); - } - catch(UnsupportedEncodingException uu) - { + + } catch(UnsupportedEncodingException uu) { Log.log(Log.ERROR,this,uu); Object[] pp = { buffer.getProperty(Buffer.ENCODING), uu.toString() }; VFSManager.error(view,path,"ioerror.encoding-error",pp); buffer.setBooleanProperty(ERROR_OCCURRED,true); - } - catch(IOException io) - { + + } catch(IOException io) { Log.log(Log.ERROR,this,io); Object[] pp = { io.toString() }; VFSManager.error(view,path,"ioerror.read-error",pp); buffer.setBooleanProperty(ERROR_OCCURRED,true); - } - catch(OutOfMemoryError oom) - { + + } catch(OutOfMemoryError oom) { Log.log(Log.ERROR,this,oom); VFSManager.error(view,path,"out-of-memory-error",null); buffer.setBooleanProperty(ERROR_OCCURRED,true); } - if(jEdit.getBooleanProperty("persistentMarkers")) - { - try - { + if (jEdit.getBooleanProperty("persistentMarkers")) { + try { String[] args = { vfs.getFileName(path) }; - if(!buffer.isTemporary()) + if (!buffer.isTemporary()) { setStatus(jEdit.getProperty("vfs.status.load-markers",args)); + } setAbortable(true); in = vfs._createInputStream(session,markersPath,true,view); if(in != null) readMarkers(buffer,in); - } - catch(IOException io) - { + } catch(IOException io) { // ignore } } - } - catch(WorkThread.Abort a) - { - if(in != null) - { - try - { + } catch(WorkThread.Abort a) { + if (in != null) { + try { in.close(); } - catch(IOException io) - { - } + catch(IOException io) {} } buffer.setBooleanProperty(ERROR_OCCURRED,true); - } - finally - { - try - { + } finally { + try { vfs._endVFSSession(session,view); - } - catch(IOException io) - { + } catch(IOException io) { Log.log(Log.ERROR,this,io); String[] pp = { io.toString() }; VFSManager.error(view,path,"ioerror.read-error",pp); buffer.setBooleanProperty(ERROR_OCCURRED,true); - } - catch(WorkThread.Abort a) - { + } catch(WorkThread.Abort a) { buffer.setBooleanProperty(ERROR_OCCURRED,true); } } Added: branches/jsxe2/src/net/sourceforge/jsxe/util/WorkRequest.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/util/WorkRequest.java (rev 0) +++ branches/jsxe2/src/net/sourceforge/jsxe/util/WorkRequest.java 2006-07-28 20:04:32 UTC (rev 1081) @@ -0,0 +1,77 @@ +/* +WorkRequest.java +:tabSize=4:indentSize=4:noTabs=true: +:folding=explicit:collapseFolds=1: + +Copyright (C) 2000 Slava Pestov + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +Optionally, you may find a copy of the GNU General Public License +from http://www.fsf.org/copyleft/gpl.txt +*/ + +package net.sourceforge.jsxe.util; + +/** + * A subclass of the Runnable interface. + * @author Slava Pestov + * @version $Id$ + * @since jsXe 0.5 pre3 + */ +public abstract class WorkRequest implements Runnable { + + /** + * Sets if the request can be aborted. + */ + public void setAbortable(boolean abortable) { + Thread thread = Thread.currentThread(); + if (thread instanceof WorkThread) { + ((WorkThread)thread).setAbortable(abortable); + } + } + + /** + * Sets the status text. + * @param status The status text + */ + public void setStatus(String status) { + Thread thread = Thread.currentThread(); + if (thread instanceof WorkThread) { + ((WorkThread)thread).setStatus(status); + } + } + + /** + * Sets the progress value. + * @param value The progress value. + */ + public void setProgressValue(int value) { + Thread thread = Thread.currentThread(); + if (thread instanceof WorkThread) { + ((WorkThread)thread).setProgressValue(value); + } + } + + /** + * Sets the maximum progress value. + * @param value The progress value. + */ + public void setProgressMaximum(int value) { + Thread thread = Thread.currentThread(); + if (thread instanceof WorkThread) { + ((WorkThread)thread).setProgressMaximum(value); + } + } +} Property changes on: branches/jsxe2/src/net/sourceforge/jsxe/util/WorkRequest.java ___________________________________________________________________ Name: svn:executable + * Added: branches/jsxe2/src/net/sourceforge/jsxe/util/WorkThread.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/util/WorkThread.java (rev 0) +++ branches/jsxe2/src/net/sourceforge/jsxe/util/WorkThread.java 2006-07-28 20:04:32 UTC (rev 1081) @@ -0,0 +1,196 @@ +/* +WorkThread.java +:tabSize=4:indentSize=4:noTabs=true: +:folding=explicit:collapseFolds=1: + +Copyright (C) 2000 Slava Pestov + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +Optionally, you may find a copy of the GNU General Public License +from http://www.fsf.org/copyleft/gpl.txt +*/ + +package net.sourceforge.jsxe.util; + +/** + * Services work requests in the background. + * @author Slava Pestov + * @version $Id$ + * @since jsXe 0.5 pre3 + */ +public class WorkThread extends Thread { + + public WorkThread(WorkThreadPool pool, ThreadGroup group, String name) { + super(group, name); + // so that jEdit doesn't exit with no views open automatically + //setDaemon(true); + setPriority(Thread.MIN_PRIORITY); + + this.pool = pool; + } + + /** + * Sets if the current request can be aborted. + */ + public void setAbortable(boolean abortable) { + synchronized(abortLock) { + this.abortable = abortable; + if (aborted) { + stop(new Abort()); + } + } + } + + /** + * Returns if the work thread is currently running a request. + */ + public boolean isRequestRunning() { + return requestRunning; + } + + /** + * Returns the status text. + */ + public String getStatus() { + return status; + } + + /** + * Sets the status text. + */ + public void setStatus(String status) { + this.status = status; + pool.fireProgressChanged(this); + } + + /** + * Returns the progress value. + */ + public int getProgressValue() { + return progressValue; + } + + /** + * Sets the progress value. + */ + public void setProgressValue(int progressValue) { + this.progressValue = progressValue; + pool.fireProgressChanged(this); + } + + /** + * Returns the progress maximum. + */ + public int getProgressMaximum() { + return progressMaximum; + } + + /** + * Sets the maximum progress value. + */ + public void setProgressMaximum(int progressMaximum) { + this.progressMaximum = progressMaximum; + pool.fireProgressChanged(this); + } + + /** + * Aborts the currently running request, if allowed. + */ + public void abortCurrentRequest() { + synchronized(abortLock) { + if (abortable && !aborted) { + stop(new Abort()); + } + aborted = true; + } + } + + public void run() { + Log.log(Log.DEBUG,this,"Work request thread starting [" + getName() + "]"); + + for(;;) { + doRequests(); + } + } + + // private members + private WorkThreadPool pool; + private Object abortLock = new Object(); + private boolean requestRunning; + private boolean abortable; + private boolean aborted; + private String status; + private int progressValue; + private int progressMaximum; + + private void doRequests() { + WorkThreadPool.Request request; + for(;;) { + request = pool.getNextRequest(); + if (request == null) { + break; + } else { + requestRunning = true; + pool.fireStatusChanged(this); + doRequest(request); + requestRunning = false; + } + } + + pool.fireStatusChanged(this); + + synchronized(pool.waitForAllLock) { + // notify a running waitForRequests() method + pool.waitForAllLock.notifyAll(); + } + + synchronized(pool.lock) { + // wait for more requests + try { + pool.lock.wait(); + } catch(InterruptedException ie) { + Log.log(Log.ERROR,this,ie); + } + } + } + + private void doRequest(WorkThreadPool.Request request) { + Log.log(Log.DEBUG,WorkThread.class, "Running in work thread: " + request); + + try { + request.run.run(); + } catch(Abort a) { + Log.log(Log.ERROR,WorkThread.class,"Unhandled abort"); + } catch(Throwable t) { + Log.log(Log.ERROR,WorkThread.class,"Exception " + + "in work thread:"); + Log.log(Log.ERROR,WorkThread.class,t); + } finally { + synchronized(abortLock) { + aborted = abortable = false; + } + status = null; + progressValue = progressMaximum = 0; + pool.requestDone(); + pool.fireStatusChanged(this); + } + } + + public static class Abort extends Error { + public Abort() { + super("Work request aborted"); + } + } +} Property changes on: branches/jsxe2/src/net/sourceforge/jsxe/util/WorkThread.java ___________________________________________________________________ Name: svn:executable + * Added: branches/jsxe2/src/net/sourceforge/jsxe/util/WorkThreadPool.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/util/WorkThreadPool.java (rev 0) +++ branches/jsxe2/src/net/sourceforge/jsxe/util/WorkThreadPool.java 2006-07-28 20:04:32 UTC (rev 1081) @@ -0,0 +1,473 @@ +/* +WorkThreadPool.java +:tabSize=4:indentSize=4:noTabs=true: +:folding=explicit:collapseFolds=1: + +Copyright (C) 2000 Slava Pestov + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +Optionally, you may find a copy of the GNU General Public License +from http://www.fsf.org/copyleft/gpl.txt +*/ +package net.sourceforge.jsxe.util; + +//{{{ Imports +import javax.swing.event.EventListenerList; +import javax.swing.SwingUtilities; +//}}} + +/** + * A pool of work threads. + * @author Slava Pestov + * @version $Id$ + * @see net.sourceforge.jsxe.util.WorkThread + * @since jsXe 0.5 pre3 + */ +public class WorkThreadPool { + + //{{{ WorkThreadPool constructor + /** + * Creates a new work thread pool with the specified number of + * work threads. + * @param name The thread name prefix + * @param count The number of work threads + */ + public WorkThreadPool(String name, int count) { + + listenerList = new EventListenerList(); + + if (count != 0) { + threadGroup = new ThreadGroup(name); + threads = new WorkThread[count]; + for (int i = 0; i < threads.length; i++) { + threads[i] = new WorkThread(this,threadGroup,name + " #" + (i+1)); + } + } else { + Log.log(Log.WARNING,this,"Async I/O disabled"); + } + } //}}} + + //{{{ start() method + /** + * Starts all the threads in this thread pool. + */ + public void start() { + /* not really needed since threads don't start until after */ + synchronized(lock) { + started = true; + + if (awtRequestCount != 0 && requestCount == 0) { + queueAWTRunner(); + } + } + + if (threads != null) { + for(int i = 0; i < threads.length; i++) { + threads[i].start(); + } + } + } //}}} + + //{{{ addWorkRequest() method + /** + * Adds a work request to the queue. + * @param run The runnable + * @param inAWT If true, will be executed in AWT thread. Otherwise, + * will be executed in work thread + */ + public void addWorkRequest(Runnable run, boolean inAWT) { + if (threads == null) { + run.run(); + return; + } + + synchronized(lock) { + //{{{ if there are no requests, execute AWT requests immediately + if (started && inAWT && requestCount == 0 && awtRequestCount == 0) { + // Log.log(Log.DEBUG,this,"AWT immediate: " + run); + + if (SwingUtilities.isEventDispatchThread()) { + run.run(); + } else { + SwingUtilities.invokeLater(run); + } + + return; + } //}}} + + Request request = new Request(run); + + + if (inAWT) { + //{{{ Add to AWT queue... + if (firstAWTRequest == null && lastAWTRequest == null) { + firstAWTRequest = lastAWTRequest = request; + } else { + lastAWTRequest.next = request; + lastAWTRequest = request; + } + + awtRequestCount++; + + // if no requests are running, requestDone() + // will not be called, so we must queue the + // AWT runner ourselves. + if (started && requestCount == 0) { + queueAWTRunner(); + } + //}}} + } else { + //{{{ Add to work thread queue... + if (firstRequest == null && lastRequest == null) { + firstRequest = lastRequest = request; + } else{ + lastRequest.next = request; + lastRequest = request; + } + + requestCount++; + //}}} + } + + lock.notifyAll(); + } + } //}}} + + //{{{ waitForRequests() method + /** + * Waits until all requests are complete. + */ + public void waitForRequests() + { + if(threads == null) + return; + + synchronized(waitForAllLock) + { + while(requestCount != 0) + { + try + { + waitForAllLock.wait(); + } + catch(InterruptedException ie) + { + Log.log(Log.ERROR,this,ie); + } + } + } + + if(SwingUtilities.isEventDispatchThread()) + { + // do any queued AWT runnables + doAWTRequests(); + } + else + { + try + { + SwingUtilities.invokeAndWait(new RunRequestsInAWTThread()); + } + catch(Exception e) + { + Log.log(Log.ERROR,this,e); + } + } + } //}}} + + //{{{ getRequestCount() method + /** + * Returns the number of pending requests. + */ + public int getRequestCount() + { + return requestCount; + } //}}} + + //{{{ getThreadCount() method + /** + * Returns the number of threads in this pool. + */ + public int getThreadCount() + { + if(threads == null) + return 0; + else + return threads.length; + } //}}} + + //{{{ getThread() method + /** + * Returns the specified thread. + * @param index The index of the thread + */ + public WorkThread getThread(int index) + { + return threads[index]; + } //}}} + + //{{{ addProgressListener() method + /** + * Adds a progress listener to this thread pool. + * @param listener The listener + */ + public void addProgressListener(WorkThreadProgressListener listener) + { + listenerList.add(WorkThreadProgressListener.class,listener); + } //}}} + + //{{{ removeProgressListener() method + /** + * Removes a progress listener from this thread pool. + * @param listener The listener + */ + public void removeProgressListener(WorkThreadProgressListener listener) + { + listenerList.remove(WorkThreadProgressListener.class,listener); + } //}}} + + //{{{ Package-private members + Object lock = new Object(); + Object waitForAllLock = new Object(); + + //{{{ fireStatusChanged() method + void fireStatusChanged(WorkThread thread) + { + final Object[] listeners = listenerList.getListenerList(); + if(listeners.length != 0) + { + int index = 0; + for(int i = 0; i < threads.length; i++) + { + if(threads[i] == thread) + { + index = i; + break; + } + } + + for(int i = listeners.length - 2; i >= 0; i--) + { + if(listeners[i] == WorkThreadProgressListener.class) + { + ((WorkThreadProgressListener)listeners[i+1]) + .statusUpdate(WorkThreadPool.this,index); + } + } + } + } //}}} + + //{{{ fireProgressChanged() method + void fireProgressChanged(WorkThread thread) + { + final Object[] listeners = listenerList.getListenerList(); + if(listeners.length != 0) + { + int index = 0; + for(int i = 0; i < threads.length; i++) + { + if(threads[i] == thread) + { + index = i; + break; + } + } + + for(int i = listeners.length - 2; i >= 0; i--) + { + if(listeners[i] == WorkThreadProgressListener.class) + { + ((WorkThreadProgressListener)listeners[i+1]) + .progressUpdate(WorkThreadPool.this,index); + } + } + } + } //}}} + + //{{{ requestDone() method + void requestDone() + { + synchronized(lock) + { + requestCount--; + + if(requestCount == 0 && firstAWTRequest != null) + queueAWTRunner(); + } + } //}}} + + //{{{ getNextRequest() method + Request getNextRequest() + { + synchronized(lock) + { + Request request = firstRequest; + if(request == null) + return null; + + firstRequest = firstRequest.next; + if(firstRequest == null) + lastRequest = null; + + if(request.alreadyRun) + throw new InternalError("AIEE!!! Request run twice!!! " + request.run); + request.alreadyRun = true; + + /* StringBuffer buf = new StringBuffer("request queue is now: "); + Request _request = request.next; + while(_request != null) + { + buf.append(_request.id); + if(_request.next != null) + buf.append(","); + _request = _request.next; + } + Log.log(Log.DEBUG,this,buf.toString()); */ + + return request; + } + } //}}} + + //}}} + + //{{{ Private members + + //{{{ Instance variables + private boolean started; + private ThreadGroup threadGroup; + private WorkThread[] threads; + + // Request queue + private Request firstRequest; + private Request lastRequest; + private int requestCount; + + // AWT thread magic + private boolean awtRunnerQueued; + private Request firstAWTRequest; + private Request lastAWTRequest; + private int awtRequestCount; + + private EventListenerList listenerList; + //}}} + + //{{{ doAWTRequests() method + /** Must always be called with the lock held. */ + private void doAWTRequests() + { + while(requestCount == 0 && firstAWTRequest != null) + { + doAWTRequest(getNextAWTRequest()); + } + } //}}} + + //{{{ doAWTRequest() method + /** Must always be called with the lock held. */ + private void doAWTRequest(Request request) + { +// Log.log(Log.DEBUG,this,"Running in AWT thread: " + request); + + try + { + request.run.run(); + } + catch(Throwable t) + { + Log.log(Log.ERROR,WorkThread.class,"Exception " + + "in AWT thread:"); + Log.log(Log.ERROR,WorkThread.class,t); + } + + awtRequestCount--; + } //}}} + + //{{{ queueAWTRunner() method + /** Must always be called with the lock held. */ + private void queueAWTRunner() + { + if(!awtRunnerQueued) + { + awtRunnerQueued = true; + SwingUtilities.invokeLater(new RunRequestsInAWTThread()); +// Log.log(Log.DEBUG,this,"AWT runner queued"); + } + } //}}} + + //{{{ getNextAWTRequest() method + private Request getNextAWTRequest() + { + Request request = firstAWTRequest; + firstAWTRequest = firstAWTRequest.next; + if(firstAWTRequest == null) + lastAWTRequest = null; + + if(request.alreadyRun) + throw new InternalError("AIEE!!! Request run twice!!! " + request.run); + request.alreadyRun = true; + + /* StringBuffer buf = new StringBuffer("AWT request queue is now: "); + Request _request = request.next; + while(_request != null) + { + buf.append(_request.id); + if(_request.next != null) + buf.append(","); + _request = _request.next; + } + Log.log(Log.DEBUG,this,buf.toString()); */ + + return request; + } //}}} + + //}}} + + static int ID; + + //{{{ Request class + static class Request + { + int id = ++ID; + + Runnable run; + + boolean alreadyRun; + + Request next; + + Request(Runnable run) + { + this.run = run; + } + + public String toString() + { + return "[id=" + id + ",run=" + run + "]"; + } + } //}}} + + //{{{ RunRequestsInAWTThread class + class RunRequestsInAWTThread implements Runnable + { + public void run() + { + synchronized(lock) + { + awtRunnerQueued = false; + if(requestCount == 0) + doAWTRequests(); + } + } + } //}}} +} Property changes on: branches/jsxe2/src/net/sourceforge/jsxe/util/WorkThreadPool.java ___________________________________________________________________ Name: svn:executable + * Added: branches/jsxe2/src/net/sourceforge/jsxe/util/WorkThreadProgressListener.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/util/WorkThreadProgressListener.java (rev 0) +++ branches/jsxe2/src/net/sourceforge/jsxe/util/WorkThreadProgressListener.java 2006-07-28 20:04:32 UTC (rev 1081) @@ -0,0 +1,40 @@ +/* +WorkThreadProgressListener.java +:tabSize=4:indentSize=4:noTabs=true: +:folding=explicit:collapseFolds=1: + +Copyright (C) 2000 Slava Pestov + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +Optionally, you may find a copy of the GNU General Public License +from http://www.fsf.org/copyleft/gpl.txt +*/ + +package net.sourceforge.jsxe.util; + +import java.util.EventListener; + +/** + * A work thread execution progress listener. + * @since jEdit 2.6pre1 + */ +public interface WorkThreadProgressListener extends EventListener { + + // status message changed, operation started, operation ends, ... + void statusUpdate(WorkThreadPool threadPool, int threadIndex); + + // progress bar value change + void progressUpdate(WorkThreadPool threadPool, int threadIndex); +} Property changes on: branches/jsxe2/src/net/sourceforge/jsxe/util/WorkThreadProgressListener.java ___________________________________________________________________ Name: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |