Package org.erlide.runtime.rpc

Examples of org.erlide.runtime.rpc.RpcFuture


                }
            }

            @Override
            protected RpcFuture call() throws BackendException {
                final RpcFuture result = xrefService.addProject(ErlangEngine
                        .getInstance().getModelUtilService().getProject(module));
                return result;
            }

            @Override
View Full Code Here


            final IResource resource = bres.getResource();
            MarkerUtils.deleteMarkers(resource);
            if ("erl".equals(resource.getFileExtension())) {
                final String outputDir = erlProject.getProperties().getOutputDir()
                        .toString();
                final RpcFuture f = helper.startCompileErl(project, bres, outputDir,
                        backend.getOtpRpc(), compilerOptions, kind == BuildKind.FULL);
                if (f != null) {
                    results.put(f, resource);
                }
            } else if ("yrl".equals(resource.getFileExtension())) {
                final RpcFuture f = helper.startCompileYrl(project, resource,
                        backend.getOtpRpc(), compilerOptions);
                if (f != null) {
                    results.put(f, resource);
                }
            } else {
View Full Code Here

    @Override
    public void run() {
        final T context = prepare();
        try {
            final RpcFuture result = call();
            if (result == null) {
                return;
            }
            final Job job = new UIJob("async call updater") {
                @Override
                public IStatus runInUIThread(final IProgressMonitor monitor) {
                    try {
                        if (result.checkedGet(1, TimeUnit.MILLISECONDS) == null) {
                            schedule(interval);
                        }
                    } catch (final RpcException e) {
                        ErlLogger.error(e);
                    } catch (final TimeoutException e) {
View Full Code Here

    @Override
    public void cleanUp(final IResource resource) throws Exception {
        // invoke erl_tidy in the background
        final String absolutePathToErlangModule = resource.getLocation().toString();
        final RpcFuture erlTidyFuture = backend.async_call("erl_tidy", "file", "s",
                absolutePathToErlangModule);

        // wait as long as reasonable for erl_tidy to finish
        erlTidyFuture.get(PATIENCE_LIMIT, TimeUnit.MILLISECONDS);

        // refresh the resource so it reflects the altered state on disk
        resource.refreshLocal(IResource.DEPTH_ZERO, null);
    }
View Full Code Here

        return erl;
    }

    public void compileErl(final @NonNull IProject project, final BuildResource resource,
            final String outputDir, final IOtpRpc b, final OtpErlangList compilerOptions) {
        final RpcFuture res = startCompileErl(project, resource, outputDir, b,
                compilerOptions, true);
        if (res == null) {
            ErlLogger.warn("error compiling erl file: "
                    + resource.getResource().getProjectRelativePath());
            return;
        }
        try {
            final OtpErlangObject result = res.checkedGet();
            completeCompile(project, resource.getResource(), result, b, compilerOptions);
        } catch (final RpcException e) {
            ErlLogger.warn(e);
        }
    }
View Full Code Here

        }
    }

    public void compileYrl(final @NonNull IProject project, final BuildResource resource,
            final IOtpRpc b, final OtpErlangList compilerOptions) {
        final RpcFuture res = startCompileYrl(project, resource.getResource(), b,
                compilerOptions);
        if (res == null) {
            ErlLogger.warn("error compiling yrl file: "
                    + resource.getResource().getProjectRelativePath());
            return;
        }
        try {
            completeCompile(project, resource.getResource(), res.checkedGet(), b,
                    compilerOptions);
        } catch (final RpcException e) {
            ErlLogger.warn(e);
        }
    }
View Full Code Here

                    + "]";
            monitor.subTask(fileNames);
            ErlLogger.trace("dialyzer", "run %s", fileNames);

            final IOtpRpc b = backend.getOtpRpc();
            final RpcFuture future = ErlideDialyze.dialyze(b, files, pltPaths,
                    includeDirs, fromSource, noCheckPLT);

            while (!future.isDone()) {
                // check cancellation
                if (monitor.isCanceled()) {
                    throw new OperationCanceledException();
                }
                // check backend down
                if (!backend.isRunning()) {
                    throw new BackendException("Dialyzer: backend " + backend.getName()
                            + " is down");
                }

                OtpErlangObject r = null;
                try {
                    r = future.checkedGet(500, TimeUnit.MILLISECONDS);
                } catch (final TimeoutException e) {
                } catch (final RpcTimeoutException e) {
                }
                if (r != null) {
                    processResult(b, r);
View Full Code Here

    @Override
    public void async_call_cb(final IRpcCallback cb, final long timeout,
            final OtpErlangObject gleader, final String module, final String fun,
            final String signature, final Object... args) throws RpcException {
        try {
            final RpcFuture future = sendRpcCall(localNode, nodeName, false, gleader,
                    module, fun, signature, args);
            final Runnable target = new Runnable() {
                @Override
                public void run() {
                    OtpErlangObject result;
                    try {
                        result = future.checkedGet(timeout, TimeUnit.MILLISECONDS);
                        cb.onSuccess(result);
                    } catch (final Exception e) {
                        ErlLogger.error("Could not execute RPC " + module + ":" + fun
                                + " : " + e.getMessage());
                        cb.onFailure(e);
View Full Code Here

    public OtpErlangObject call(final long timeout, final OtpErlangObject gleader,
            final String module, final String fun, final String signature,
            final Object... args0) throws RpcException {
        OtpErlangObject result;
        try {
            final RpcFuture future = sendRpcCall(localNode, nodeName, false, gleader,
                    module, fun, signature, args0);
            OtpErlangObject result1;
            result1 = future.checkedGet(timeout, TimeUnit.MILLISECONDS);
            if (CHECK_RPC) {
                ErlLogger.debug("RPC result:: " + result1);
            }
            if (isBadRpc(result1)) {
                throw new RpcException(result1.toString());
View Full Code Here

        //
        mbox.send("rex", peer, res);
        if (CHECK_RPC) {
            ErlLogger.debug("RPC " + mbox.hashCode() + "=> " + res);
        }
        return new RpcFuture(ref, mbox, module + ":" + fun + "/" + args0.length,
                logCalls, this);
    }
View Full Code Here

TOP

Related Classes of org.erlide.runtime.rpc.RpcFuture

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.