mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-14 20:45:22 +02:00
[220126] [dstore][api][breaking] executeThread() api for ISystemService
This commit is contained in:
parent
eda29e5918
commit
43d5a99638
2 changed files with 36 additions and 1 deletions
|
@ -26,4 +26,13 @@ public interface ISystemService
|
||||||
* @param client the object of the client
|
* @param client the object of the client
|
||||||
*/
|
*/
|
||||||
public void setThreadSecurity(Client client);
|
public void setThreadSecurity(Client client);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is used to execute run() in a thread assigned
|
||||||
|
* from thread pools.
|
||||||
|
*
|
||||||
|
* @param securedThread the securedThread object that implements
|
||||||
|
* Runnable.
|
||||||
|
*/
|
||||||
|
public void executeThread(SecuredThread securedThread);
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,6 +132,32 @@ public class SecuredThread extends Thread
|
||||||
|
|
||||||
super.run();
|
super.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When start() is called, a check is made to see if there is an ISystemService.
|
||||||
|
* If there is, the <code>ISystemService.executeThread(SecuredThread)</code> is called.
|
||||||
|
* In this case, the run() method is invoked in a thread assigned from the running
|
||||||
|
* work threads
|
||||||
|
* If there isn't, the <code>super.start()</code> is called.
|
||||||
|
* In this case. the run() method is invoked as a new thread.
|
||||||
|
*/
|
||||||
|
public void start()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ISystemService systemService = SystemServiceManager.getInstance().getSystemService();
|
||||||
|
if (systemService != null){
|
||||||
|
systemService.executeThread(this);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
super.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Throwable e)
|
||||||
|
{
|
||||||
|
e.printStackTrace(new PrintWriter(System.err));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue