Package co.paralleluniverse.fibers

Examples of co.paralleluniverse.fibers.Fiber


        response = (HttpServletResponse) res;
        req.setAttribute("org.apache.catalina.ASYNC_SUPPORTED", true);
        final AsyncContext ac = req.startAsync();
        ac.setTimeout(120000);
        final FiberHttpServletRequest srad = new FiberHttpServletRequest(request);
        new Fiber(null, stackSize, new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                try {
                    // TODO: check if ac has expired
                    currentAsyncContext.set(ac);
View Full Code Here


    public final void service(final ServletRequest req, final ServletResponse res) {
        req.setAttribute("org.apache.catalina.ASYNC_SUPPORTED", true);
        final AsyncContext ac = req.startAsync();
        ac.setTimeout(120000);
        final FiberServletRequest srad = wrapRequest(req);
        new Fiber(null, stackSize, new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                try {
                    // TODO: check if ac has expired
                    currentAsyncContext.set(ac);
View Full Code Here

    private Strand createStrandForActor(Strand oldStrand, Actor actor) {
        final Strand strand;
        if (oldStrand != null)
            strand = Strand.clone(oldStrand, actor);
        else
            strand = new Fiber(actor);
        actor.setStrand(strand);
        return strand;
    }
View Full Code Here

    @Override
    public final void service(final ServletRequest req, final ServletResponse res) {
        req.setAttribute("org.apache.catalina.ASYNC_SUPPORTED", true);
        final AsyncContext ac = req.startAsync();
        final FiberServletRequest srad = wrapRequest(req);
        new Fiber(new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                try {
                    currentAsyncContext.set(ac);
                    suspendableService(srad, res);
View Full Code Here

    @Override
    public final void service(final ServletRequest req, final ServletResponse res) {
        req.setAttribute("org.apache.catalina.ASYNC_SUPPORTED", true);
        final AsyncContext ac = req.startAsync();
        final FiberServletRequest srad = wrapRequest(req);
        new Fiber(null, stackSize, new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                try {
                    currentAsyncContext.set(ac);
                    suspendableService(srad, res);
View Full Code Here

     * @param scheduler The new fiber's scheduler.
     * @return This actors' ActorRef
     */
    public ActorRef<Message> spawn(FiberScheduler scheduler) {
        checkReplacement();
        new Fiber(getName(), scheduler, runner).start();
        return ref();
    }
View Full Code Here

     *
     * @return This actors' ActorRef
     */
    public ActorRef<Message> spawn() {
        checkReplacement();
        new Fiber(getName(), runner).start();
        return ref();
    }
View Full Code Here

    /**
     * Returns the actor currently running in the current strand.
     */
    public static <M, V> Actor<M, V> currentActor() {
        final Fiber currentFiber = Fiber.currentFiber();
        if (currentFiber == null)
            return currentActor.get();
        final SuspendableCallable target = currentFiber.getTarget();
        if (target == null)
            return null;
        if (target instanceof Actor)
            return (Actor<M, V>) target;
        if (target instanceof ActorRunner)
View Full Code Here

    private ActorRefImpl myRef() {
        return ((ActorRefImpl) ref);
    }

    public ActorRef<Message> spawn(FiberScheduler scheduler) {
        new Fiber(getName(), scheduler, this).start();
        return ref();
    }
View Full Code Here

        new Fiber(getName(), scheduler, this).start();
        return ref();
    }

    public ActorRef<Message> spawn() {
        new Fiber(getName(), this).start();
        return ref();
    }
View Full Code Here

TOP

Related Classes of co.paralleluniverse.fibers.Fiber

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.