@Nullable @Override public Future<Callbacks.ConstantAffection> request( String ownerClassName, String fieldName, int accessFlags, boolean fieldRemoved, boolean accessChanged) { final CmdlineRemoteProto.Message.BuilderMessage.ConstantSearchTask.Builder task = CmdlineRemoteProto.Message.BuilderMessage.ConstantSearchTask.newBuilder(); task.setOwnerClassName(ownerClassName); task.setFieldName(fieldName); task.setAccessFlags(accessFlags); task.setIsAccessChanged(accessChanged); task.setIsFieldRemoved(fieldRemoved); final ConstantSearchFuture future = new ConstantSearchFuture(BuildSession.this); final ConstantSearchFuture prev = mySearchTasks.put(new Pair<String, String>(ownerClassName, fieldName), future); if (prev != null) { prev.setDone(); } Channels.write( myChannel, CmdlineProtoUtil.toMessage( mySessionId, CmdlineRemoteProto.Message.BuilderMessage.newBuilder() .setType(CmdlineRemoteProto.Message.BuilderMessage.Type.CONSTANT_SEARCH_TASK) .setConstantSearchTask(task.build()) .build())); return future; }
public void processConstantSearchResult( CmdlineRemoteProto.Message.ControllerMessage.ConstantSearchResult result) { final ConstantSearchFuture future = mySearchTasks.remove(Pair.create(result.getOwnerClassName(), result.getFieldName())); if (future != null) { if (result.getIsSuccess()) { final List<String> paths = result.getPathList(); final List<File> files = new ArrayList<File>(paths.size()); for (String path : paths) { files.add(new File(path)); } future.setResult(files); LOG.debug("Constant search result: " + files.size() + " affected files found"); } else { future.setDone(); LOG.debug("Constant search failed"); } } }