Buggy code:
public final class ChannelEndpointImpl implements ChannelEndpoint { int usageCounter = 1 ; protected NetworkChannel networkChannel ; private Map remoteServices = new HashMap ( 0 ) ; private List remoteTopics = new ArrayList ( 0 ) ; private TimeOffset timeOffset ; private static final int TIMEOUT = 120000 ; protected final Map callbacks = new HashMap ( 0 ) ; private final HashMap localServices = new HashMap ( 2 ) ; private final HashMap proxiedServices = new HashMap ( 0 ) ; protected final HashMap proxyBundles = new HashMap ( 0 ) ; private final HashMap streams = new HashMap ( 0 ) ; private short nextStreamID = 0 ; private ServiceRegistration handlerReg = null ; private static final String NO_LOOPS = ( "(!(" + ( RemoteEventMessage . EVENT_SENDER_URI ) ) + "=*))" ; private ArrayList workQueue = new ArrayList ( ) ; boolean hasRedundantLinks = false ; ChannelEndpointImpl ( final NetworkChannelFactory factory , final URI endpointAddress ) throws RemoteOSGiException , IOException { } ChannelEndpointImpl ( final NetworkChannel channel ) { } private void initThreadPool ( ) { final ThreadGroup threadPool = new ThreadGroup ( ( "WorkerThreads" + ( toString ( ) ) ) ) ; for ( int i = 0 ; i < ( RemoteOSGiServiceImpl . MAX_THREADS_PER_ENDPOINT ) ; i ++ ) { <START_BUG> final Thread t = new Thread ( threadPool , ( "WorkerThread" + i ) ) { <END_BUG> public void run ( ) { try { while ( ! ( isInterrupted ( ) ) ) { final Runnable r ; synchronized ( workQueue ) { while ( workQueue . isEmpty ( ) ) { workQueue . wait ( ) ; } r = ( ( Runnable ) ( workQueue . remove ( 0 ) ) ) ; } r . run ( ) ; } } catch ( InterruptedException ie ) { ie . printStackTrace ( ) ; } } } ; t . start ( ) ; } } public void receivedMessage ( final RemoteOSGiMessage msg ) { } public Object invokeMethod ( final String service , final String methodSignature , final Object [ ] args ) throws Throwable { } void asyncRemoteCall ( final String fragment , final String methodSignature , final Object [ ] args , final AsyncRemoteCallCallback callback ) { } public Dictionary getProperties ( final String serviceID ) { } public Dictionary getPresentationProperties ( final String serviceID ) { } public void trackRegistration ( final String serviceID , final ServiceRegistration reg ) { } public void untrackRegistration ( final String serviceID ) { } public TimeOffset getOffset ( ) throws RemoteOSGiException { } public void dispose ( ) { } public boolean isConnected ( ) { } public String toString ( ) { } public int readStream ( final short streamID ) throws IOException { } public int readStream ( final short streamID , final byte [ ] b , final int off , final int len ) throws IOException { } public void writeStream ( final short streamID , final int b ) throws IOException { } public void writeStream ( final short streamID , final byte [ ] b , final int off , final int len ) throws IOException { } public URI getRemoteAddress ( ) { } URI getLocalAddress ( ) { } RemoteServiceReference [ ] sendLease ( final RemoteServiceRegistration [ ] myServices , final String [ ] myTopics ) { } void sendLeaseUpdate ( final LeaseUpdateMessage msg ) { } boolean isActive ( final String uri ) { } void getProxyBundle ( final RemoteServiceReference ref ) throws RemoteOSGiException , IOException { } private void installResolveAndStartBundle ( final RemoteServiceReference ref , final InputStream in , final boolean isProxy ) { } void getCloneBundle ( final RemoteServiceReference ref ) { } private String [ ] getTokens ( final String str ) { } private void retrieveDependencies ( final String importString , final String exportString ) { } RemoteServiceReferenceImpl getRemoteReference ( final String uri ) { } RemoteServiceReference [ ] getAllRemoteReferences ( final Filter filter ) { } void ungetRemoteService ( final URI uri ) { } void send ( final RemoteOSGiMessage msg ) { } RemoteOSGiMessage handleMessage ( final RemoteOSGiMessage msg ) throws RemoteOSGiException { } private RemoteOSGiMessage sendAndWait ( final RemoteOSGiMessage msg ) { } private RemoteServiceRegistration getServiceRegistration ( final String serviceID ) { } private void populateLease ( final LeaseMessage lease , final RemoteServiceRegistration [ ] regs , final String [ ] topics ) { } private RemoteServiceReference [ ] processLease ( final LeaseMessage lease ) { } private StreamResultMessage doStreamOp ( final StreamRequestMessage requestMsg ) throws IOException { } private void updateTopics ( final String [ ] topicsAdded , final String [ ] topicsRemoved ) { } private InputStreamHandle getInputStreamPlaceholder ( final InputStream origIS ) { } private InputStream getInputStreamProxy ( final InputStreamHandle placeholder ) { } private OutputStreamHandle getOutputStreamPlaceholder ( final OutputStream origOS ) { } private OutputStream getOutputStreamProxy ( final OutputStreamHandle placeholder ) { } private synchronized short nextStreamID ( ) { } private void closeStreams ( ) { } final class EventForwarder implements EventHandler { public void handleEvent ( final Event event ) { } } class WaitingCallback implements AsyncCallback { private RemoteOSGiMessage result ; public synchronized void result ( RemoteOSGiMessage msg ) { } synchronized RemoteOSGiMessage getResult ( ) { } } }

Fix:
final Thread t = new Thread ( threadPool , ( "r-OSGi<seq2seq4repair_space>ChannelWorkerThread" + i ) ) {