/** * Notify listeners about addition. */ protected void notifyAdditionListeners(final IResourceIdentifier parid, final IResourceIdentifier rid) { boolean rem = addedlinks.contains(new Tuple2<IResourceIdentifier, IResourceIdentifier>(parid, rid)); // Do not notify listeners with lock held! ILibraryServiceListener[] lis = (ILibraryServiceListener[])listeners.toArray(new ILibraryServiceListener[listeners.size()]); for(int i=0; i<lis.length; i++) { final ILibraryServiceListener liscopy = lis[i]; lis[i].resourceIdentifierAdded(parid, rid, rem).addResultListener(new IResultListener<Void>() { public void resultAvailable(Void result) { } public void exceptionOccurred(Exception exception) { // todo: how to handle timeouts?! allow manual retry? // exception.printStackTrace(); removeLibraryServiceListener(liscopy); }; }); } }
/** * Notify listeners about removal. */ protected void notifyRemovalListeners(final IResourceIdentifier parid, final IResourceIdentifier rid) { // Do not notify listeners with lock held! ILibraryServiceListener[] lis = (ILibraryServiceListener[])listeners.toArray(new ILibraryServiceListener[listeners.size()]); for(int i=0; i<lis.length; i++) { final ILibraryServiceListener liscopy = lis[i]; lis[i].resourceIdentifierRemoved(parid, rid).addResultListener(new IResultListener<Void>() { public void resultAvailable(Void result) { } public void exceptionOccurred(Exception exception) { // todo: how to handle timeouts?! allow manual retry? // exception.printStackTrace(); removeLibraryServiceListener(liscopy); }; }); } }
/** * Notify listeners about removal. */ protected void notifyRemovalListeners(final IResourceIdentifier parid, final IResourceIdentifier rid) { // Do not notify listeners with lock held! ILibraryServiceListener[] lis = (ILibraryServiceListener[])listeners.toArray(new ILibraryServiceListener[listeners.size()]); for(int i=0; i<lis.length; i++) { final ILibraryServiceListener liscopy = lis[i]; lis[i].resourceIdentifierRemoved(parid, rid).addResultListener(new IResultListener<Void>() { public void resultAvailable(Void result) { } public void exceptionOccurred(Exception exception) { // todo: how to handle timeouts?! allow manual retry? // exception.printStackTrace(); removeLibraryServiceListener(liscopy); }; }); } }
/** * Notify listeners about addition. */ protected void notifyAdditionListeners(final IResourceIdentifier parid, final IResourceIdentifier rid) { boolean rem = addedlinks.contains(new Tuple2<IResourceIdentifier, IResourceIdentifier>(parid, rid)); // Do not notify listeners with lock held! ILibraryServiceListener[] lis = (ILibraryServiceListener[])listeners.toArray(new ILibraryServiceListener[listeners.size()]); for(int i=0; i<lis.length; i++) { final ILibraryServiceListener liscopy = lis[i]; // System.out.println("added: "+parid+" "+rid); lis[i].resourceIdentifierAdded(parid, rid, rem).addResultListener(new IResultListener<Void>() { public void resultAvailable(Void result) { } public void exceptionOccurred(Exception exception) { // todo: how to handle timeouts?! allow manual retry? // exception.printStackTrace(); removeLibraryServiceListener(liscopy); }; }); } }
lis[i].resourceIdentifierRemoved(rid).addResultListener(new IResultListener<Void>()
lis[i].resourceIdentifierAdded(rid).addResultListener(new IResultListener<Void>()
lis[i].resourceIdentifierRemoved(rid).addResultListener(new IResultListener<Void>()