Examples of DispatchRequest


Examples of com.alibaba.rocketmq.store.DispatchRequest

        boolean breakdown = false;
        IndexFile indexFile = retryGetAndCreateIndexFile();
        if (indexFile != null) {
            long endPhyOffset = indexFile.getEndPhyOffset();
            MSG_WHILE: for (Object o : req) {
                DispatchRequest msg = (DispatchRequest) o;
                String topic = msg.getTopic();
                String keys = msg.getKeys();
                if (msg.getCommitLogOffset() < endPhyOffset) {
                    continue;
                }

                final int tranType = MessageSysFlag.getTransactionValue(msg.getSysFlag());
                switch (tranType) {
                case MessageSysFlag.TransactionNotType:
                case MessageSysFlag.TransactionPreparedType:
                    break;
                case MessageSysFlag.TransactionCommitType:
                case MessageSysFlag.TransactionRollbackType:
                    continue;
                }

                if (keys != null && keys.length() > 0) {
                    String[] keyset = keys.split(MessageConst.KEY_SEPARATOR);
                    for (String key : keyset) {
                        // TODO 是否需要TRIM
                        if (key.length() > 0) {
                            for (boolean ok =
                                    indexFile.putKey(buildKey(topic, key), msg.getCommitLogOffset(),
                                        msg.getStoreTimestamp()); !ok;) {
                                log.warn("index file full, so create another one, " + indexFile.getFileName());
                                indexFile = retryGetAndCreateIndexFile();
                                if (null == indexFile) {
                                    breakdown = true;
                                    break MSG_WHILE;
                                }

                                ok =
                                        indexFile.putKey(buildKey(topic, key), msg.getCommitLogOffset(),
                                            msg.getStoreTimestamp());
                            }
                        }
                    }
                }
            }
View Full Code Here

Examples of com.gwtplatform.dispatch.client.DispatchRequest

      resultCallback.onSuccess(prefetchResult);

      return new CompletedDispatchRequest();
    } else {
      // Execute
      DispatchRequest request = executeCommand.execute(action,
          new AsyncCallback<R>() {
            @Override
            public void onFailure(Throwable caught) {
              // Call postfetch with null result
              postfetch(action, null);
View Full Code Here

Examples of com.gwtplatform.dispatch.shared.DispatchRequest

            resultCallback.onSuccess(prefetchResult);

            return new CompletedDispatchRequest();
        } else {
            // Execute
            DispatchRequest request = executeCommand.execute(action,
                    new AsyncCallback<R>() {
                        @Override
                        public void onFailure(Throwable caught) {
                            // Call postfetch with null result
                            postfetch(action, null);
View Full Code Here

Examples of org.apache.tiles.request.DispatchRequest

    /**
      * Tests {@link FreemarkerRequest#getNativeScopes()}.
      */
    @Test
    public void testGetAvailableScopes() {
        DispatchRequest enclosedRequest = createMock(DispatchRequest.class);
        expect(enclosedRequest.getAvailableScopes()).andReturn(Collections.singletonList("parent"));
        replay(enclosedRequest);
        context = new VelocityRequest(enclosedRequest, velocityContext, writer);
        assertArrayEquals(new String[] {"parent", "page"}, context.getAvailableScopes().toArray());
        verify(enclosedRequest);
    }
View Full Code Here

Examples of org.apache.tiles.request.DispatchRequest

    /**
     * Tests {@link VelocityRequest#getPrintWriter()}.
     */
    @Test
    public void testGetPrintWriter() {
        DispatchRequest enclosedRequest = createMock(DispatchRequest.class);
        expect(enclosedRequest.getAvailableScopes()).andReturn(Collections.singletonList("parent"));

        replay(velocityContext, enclosedRequest);
        context = new VelocityRequest(enclosedRequest, velocityContext, writer);
        assertNotNull(context.getPrintWriter());
        verify(velocityContext, enclosedRequest);
View Full Code Here

Examples of org.apache.tiles.request.DispatchRequest

    /**
     * Tests {@link VelocityRequest#getPrintWriter()}.
     */
    @Test
    public void testGetPrintWriterPrintWriter() {
        DispatchRequest enclosedRequest = createMock(DispatchRequest.class);
        expect(enclosedRequest.getAvailableScopes()).andReturn(Collections.singletonList("parent"));

        PrintWriter printWriter = new PrintWriter(writer);
        replay(velocityContext, enclosedRequest);
        context = new VelocityRequest(enclosedRequest, velocityContext, printWriter);
        assertEquals(printWriter, context.getPrintWriter());
View Full Code Here

Examples of org.apache.tiles.request.DispatchRequest

    /**
     * Tests {@link VelocityRequest#getPrintWriter()}.
     */
    @Test(expected = IllegalStateException.class)
    public void testGetPrintWriterNoWriter() {
        DispatchRequest enclosedRequest = createMock(DispatchRequest.class);
        expect(enclosedRequest.getAvailableScopes()).andReturn(Collections.singletonList("parent"));

        replay(velocityContext, enclosedRequest);
        context = new VelocityRequest(enclosedRequest, velocityContext, null);
        context.getPrintWriter();
        verify(velocityContext, enclosedRequest);
View Full Code Here

Examples of org.apache.tiles.request.DispatchRequest

    /**
     * Tests {@link VelocityRequest#getWriter()}.
     */
    @Test
    public void testGetWriter() {
        DispatchRequest enclosedRequest = createMock(DispatchRequest.class);
        expect(enclosedRequest.getAvailableScopes()).andReturn(Collections.singletonList("parent"));

        replay(velocityContext, enclosedRequest);
        context = new VelocityRequest(enclosedRequest, velocityContext, writer);
        assertEquals(writer, context.getWriter());
        verify(velocityContext, enclosedRequest);
View Full Code Here

Examples of org.apache.tiles.request.DispatchRequest

    /**
     * Tests {@link VelocityRequest#getWriter()}.
     */
    @Test(expected = IllegalStateException.class)
    public void testGetWriterNoWriter() {
        DispatchRequest enclosedRequest = createMock(DispatchRequest.class);
        expect(enclosedRequest.getAvailableScopes()).andReturn(Collections.singletonList("parent"));

        replay(velocityContext, enclosedRequest);
        context = new VelocityRequest(enclosedRequest, velocityContext, null);
        context.getWriter();
        verify(velocityContext, enclosedRequest);
View Full Code Here

Examples of org.apache.tiles.request.DispatchRequest

    /**
     * Tests {@link VelocityRequest#getPageScope()}.
     */
    @Test
    public void testGetPageScope() {
        DispatchRequest enclosedRequest = createMock(DispatchRequest.class);
        expect(enclosedRequest.getAvailableScopes()).andReturn(Collections.singletonList("parent"));

        replay(velocityContext, enclosedRequest);
        context = new VelocityRequest(enclosedRequest, velocityContext, writer);
        assertTrue(context.getPageScope() instanceof VelocityScopeMap);
        verify(velocityContext, enclosedRequest);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.