??xml version="1.0" encoding="utf-8" standalone="yes"?>BlogJava-所有随W区http://www.fpcwrs.live/all专注于Java技?/description>zh-cnSat, 06 Jul 2019 20:53:51 GMTSat, 06 Jul 2019 20:53:51 GMT60优秀代码赏析http://www.fpcwrs.live/fool/archive/2019/07/06/434083.html? ?/dc:creator>? ?/author>Sat, 06 Jul 2019 04:06:00 GMThttp://www.fpcwrs.live/fool/archive/2019/07/06/434083.htmlhttp://www.fpcwrs.live/fool/comments/434083.htmlhttp://www.fpcwrs.live/fool/archive/2019/07/06/434083.html#Feedback0http://www.fpcwrs.live/fool/comments/commentRss/434083.htmlhttp://www.fpcwrs.live/fool/services/trackbacks/434083.html看开源的源代码,看到一个有意思的实现 ?br />/*
 * Copyright 2019 IBM All Rights Reserved.
 *
 * SPDX-License-Identifier: Apache-2.0
 */
package org.hyperledger.fabric.gateway;
import org.hyperledger.fabric.gateway.impl.AllCommitStrategy;
import org.hyperledger.fabric.gateway.impl.AnyCommitStrategy;
import org.hyperledger.fabric.gateway.impl.CommitHandlerImpl;
import org.hyperledger.fabric.gateway.impl.CommitStrategy;
import org.hyperledger.fabric.gateway.impl.NoOpCommitHandler;
import org.hyperledger.fabric.gateway.spi.CommitHandler;
import org.hyperledger.fabric.gateway.spi.CommitHandlerFactory;
import org.hyperledger.fabric.sdk.Peer;
import org.hyperledger.fabric.sdk.exception.InvalidArgumentException;
import java.util.Collection;
/**
 * Default commit handler implementations. Instances can be referenced directly or looked up by name, for example
 * {@code DefaultCommitHandlers.valueOf("NONE")}.
 */
public enum DefaultCommitHandlers implements CommitHandlerFactory {
    /**
     * Do not wait for any commit events to be received from peers after submitting a transaction.
     */
    NONE((transactionId, network) -> NoOpCommitHandler.INSTANCE),
    /**
     * Wait to receive commit events from all currently responding peers in the user's organization after submitting
     * a transaction.
     */
    MSPID_SCOPE_ALLFORTX((transactionId, network) -> {
        Collection<Peer> peers = getPeersForOrganization(network);
        CommitStrategy strategy = new AllCommitStrategy(peers);
        CommitHandler handler = new CommitHandlerImpl(transactionId, network, strategy);
        return handler;
    }),
    /**
     * Wait to receive commit events from all currently responding peers in the network after submitting a transaction.
     */
    NETWORK_SCOPE_ALLFORTX((transactionId, network) -> {
        Collection<Peer> peers = network.getChannel().getPeers();
        CommitStrategy strategy = new AllCommitStrategy(peers);
        CommitHandler handler = new CommitHandlerImpl(transactionId, network, strategy);
        return handler;
    }),
    /**
     * Wait to receive a commit event from any currently responding peer in the user's organization after submitting
     * a transaction.
     */
    MSPID_SCOPE_ANYFORTX((transactionId, network) -> {
        Collection<Peer> peers = getPeersForOrganization(network);
        CommitStrategy strategy = new AnyCommitStrategy(peers);
        CommitHandler handler = new CommitHandlerImpl(transactionId, network, strategy);
        return handler;
    }),
    /**
     * Wait to receive a commit event from any currently responding peer in the network after submitting a transaction.
     */
    NETWORK_SCOPE_ANYFORTX((transactionId, network) -> {
        Collection<Peer> peers = network.getChannel().getPeers();
        CommitStrategy strategy = new AnyCommitStrategy(peers);
        CommitHandler handler = new CommitHandlerImpl(transactionId, network, strategy);
        return handler;
    });
    private final CommitHandlerFactory factory;
    DefaultCommitHandlers(CommitHandlerFactory factory) {
        this.factory = factory;
    }
    private static Collection<Peer> getPeersForOrganization(Network network) {
        String mspId = network.getGateway().getIdentity().getMspId();
        try {
            return network.getChannel().getPeersForOrganization(mspId);
        } catch (InvalidArgumentException e) {
            // This should never happen as mspId should not be null
            throw new RuntimeException(e);
        }
    }

   //CommitHandlerFactory 接口定义 的方法,q里是其实现 
    public CommitHandler create(String transactionId, Network network) {
        return factory.create(transactionId, network);
    }
}

先看看enumcȝ构造函?br />
    DefaultCommitHandlers(CommitHandlerFactory factory) {
        this.factory = factory;
    }
需要一?CommitHandlerFactory 是个接口Q同?enumcLw也实现了这个接口?br />再来看调用过E?nbsp;
CommitHandlerFactory commitHandlerFactory = DefaultCommitHandlers.MSPID_SCOPE_ALLFORTX;
q里会调用CommitHandlerFactory 构造函敎ͼ其传入参数是
(transactionId, network) -> {
        Collection<Peer> peers = network.getChannel().getPeers();
        CommitStrategy strategy = new AllCommitStrategy(peers);
        CommitHandler handler = new CommitHandlerImpl(transactionId, network, strategy);
        return handler;
    }
它是lamdba写法Q看看构造函数需要一?nbsp;CommitHandlerFactory 接口Q这个lamdba 函数其实是CommitHandlerFactory 的实现?br />q样MSPID_SCOPE_ALLFORTX 枚Dcd有了一?nbsp; CommitHandlerFactory实现cȝ引用?br />
再看create调用?br />
CommitHandler commitHandler = commitHandlerFactory.create(transactionId, network);
q里enumcȝcreateҎ会执行, return factory.create(transactionId, network);
q回一?CommitHandler .q里才会真正执行那个 lamdba定义的函数?br />到这里只看到lamdb应用。。?br />再分析一下create ,枚Dc里的每个枚丑֏量都会实C个这个方法。这里可以看到它其实是一个工厂类?br />它创造的产品是CommitHandler ,其具体实现是CommitHandlerImplcR?br />q里巧妙的用一个enum当工厂类的实现。整个代码用了工厂模式加{略模式的实现?br />优点Q得宜于lamdb的应用,减少了具体工厂类的实现?br />~点Q工厂模式可以实C改动E序创徏产品。那么这里如果要增一个品,对这个enumc需要再d一个枚丑֏量?br />q个enumcL改动?br />



]]>
Ropsten甌试?/title><link>http://www.fpcwrs.live/waterjava/archive/2019/07/05/434073.html</link><dc:creator>狼爱上狸</dc:creator><author>狼爱上狸</author><pubDate>Fri, 05 Jul 2019 13:59:00 GMT</pubDate><guid>http://www.fpcwrs.live/waterjava/archive/2019/07/05/434073.html</guid><wfw:comment>http://www.fpcwrs.live/waterjava/comments/434073.html</wfw:comment><comments>http://www.fpcwrs.live/waterjava/archive/2019/07/05/434073.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.fpcwrs.live/waterjava/comments/commentRss/434073.html</wfw:commentRss><trackback:ping>http://www.fpcwrs.live/waterjava/services/trackbacks/434073.html</trackback:ping><description><![CDATA[?a href="https://link.jianshu.com?t=http://faucet.ropsten.be:3001/" target="_blank" rel="nofollow">http://faucet.ropsten.be:3001/</a>上申P只需要输入你在Ropsten|络上的账户地址pQ{币操作非常迅速,目前一ơ可甌1ETHQ?4时后可再次甌Q?img src ="http://www.fpcwrs.live/waterjava/aggbug/434073.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.fpcwrs.live/waterjava/" target="_blank">狼爱上狸</a> 2019-07-05 21:59 <a href="http://www.fpcwrs.live/waterjava/archive/2019/07/05/434073.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>程序技术始于微信?来看看移动端程序技术的前世今生Q?/title><link>http://www.fpcwrs.live/jb2011/archive/2019/07/04/434043.html</link><dc:creator>Jack Jiang</dc:creator><author>Jack Jiang</author><pubDate>Thu, 04 Jul 2019 04:02:00 GMT</pubDate><guid>http://www.fpcwrs.live/jb2011/archive/2019/07/04/434043.html</guid><wfw:comment>http://www.fpcwrs.live/jb2011/comments/434043.html</wfw:comment><comments>http://www.fpcwrs.live/jb2011/archive/2019/07/04/434043.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.fpcwrs.live/jb2011/comments/commentRss/434043.html</wfw:commentRss><trackback:ping>http://www.fpcwrs.live/jb2011/services/trackbacks/434043.html</trackback:ping><description><![CDATA[     摘要: 本文由DCloud 公司创始人王安原创发布于CSDNQ原题《小E序技术演q史》,x通讯|收录时有改动,感谢原作者?、引a微信的成功,q特定于某个具体的功能Q微信的成功实际上是一大批创新技术和体验的成功合集,q也是它Z如此难此被超的Ҏ原因。作为微信这个超U社交应用中最Z眼的技术之一——微信程序,俨然已成历移动端程序的代名词,很多Z提v“程?...  <a href='http://www.fpcwrs.live/jb2011/archive/2019/07/04/434043.html'>阅读全文</a><img src ="http://www.fpcwrs.live/jb2011/aggbug/434043.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.fpcwrs.live/jb2011/" target="_blank">Jack Jiang</a> 2019-07-04 12:02 <a href="http://www.fpcwrs.live/jb2011/archive/2019/07/04/434043.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>动态改变SPRING BATCH ?CHUNKSIZEhttp://www.fpcwrs.live/paulwong/archive/2019/07/02/434011.htmlpaulwongpaulwongTue, 02 Jul 2019 03:13:00 GMThttp://www.fpcwrs.live/paulwong/archive/2019/07/02/434011.htmlhttp://www.fpcwrs.live/paulwong/comments/434011.htmlhttp://www.fpcwrs.live/paulwong/archive/2019/07/02/434011.html#Feedback0http://www.fpcwrs.live/paulwong/comments/commentRss/434011.htmlhttp://www.fpcwrs.live/paulwong/services/trackbacks/434011.htmlSPRING BATCH L件时Q是按一行一行来d数据Q再按CHUNKSIZE提交到REMOTE操作Q有时要整合当前行和下几行,再决定CHUNKSIZEQ以便相关的数据能在q程同一个PROCESSOR中按序q行处理Q因为相关的数据被拆成几个CHUNK来处理的话,有可能不按序来处理。这样就需要动态调整CHUNKSIZE?br />
参照如下Q?br /> https://stackoverflow.com/questions/37390602/spring-batch-custom-completion-policy-for-dynamic-chunk-size

q结合SingleItemPeekableItemReaderQ装饰者,允许查看下一条数据,真正的操作委托给代理Q?img src ="http://www.fpcwrs.live/paulwong/aggbug/434011.html" width = "1" height = "1" />

paulwong 2019-07-02 11:13 发表评论
]]>
史上最强Java NIO入门Q担心从入门到放弃的Q请读这!http://www.fpcwrs.live/jb2011/archive/2019/06/29/434008.htmlJack JiangJack JiangSat, 29 Jun 2019 14:17:00 GMThttp://www.fpcwrs.live/jb2011/archive/2019/06/29/434008.htmlhttp://www.fpcwrs.live/jb2011/comments/434008.htmlhttp://www.fpcwrs.live/jb2011/archive/2019/06/29/434008.html#Feedback0http://www.fpcwrs.live/jb2011/comments/commentRss/434008.htmlhttp://www.fpcwrs.live/jb2011/services/trackbacks/434008.html阅读全文

Jack Jiang 2019-06-29 22:17 发表评论
]]>
web3.eth.abihttp://www.fpcwrs.live/waterjava/archive/2019/06/29/434006.html狼爱上狸狼爱上狸Sat, 29 Jun 2019 11:07:00 GMThttp://www.fpcwrs.live/waterjava/archive/2019/06/29/434006.htmlhttp://www.fpcwrs.live/waterjava/comments/434006.htmlhttp://www.fpcwrs.live/waterjava/archive/2019/06/29/434006.html#Feedback0http://www.fpcwrs.live/waterjava/comments/commentRss/434006.htmlhttp://www.fpcwrs.live/waterjava/services/trackbacks/434006.html 1.web3?.0以下版本不支持web3.eth.abi
2.var ethabi = require('web3-eth-abi');q种引用也有问题?/div>
3.升web3?.0以上版本后测试通过Q?/div>
var Web3 = require('web3');
var web3 = new Web3();

console.log(web3.eth.abi.encodeFunctionSignature('myMethod(uint256,string)'))



狼爱上狸 2019-06-29 19:07 发表评论
]]>删除无用的系l服务项http://www.fpcwrs.live/waterjava/archive/2019/06/29/434005.html狼爱上狸狼爱上狸Sat, 29 Jun 2019 03:41:00 GMThttp://www.fpcwrs.live/waterjava/archive/2019/06/29/434005.htmlhttp://www.fpcwrs.live/waterjava/comments/434005.htmlhttp://www.fpcwrs.live/waterjava/archive/2019/06/29/434005.html#Feedback0http://www.fpcwrs.live/waterjava/comments/commentRss/434005.htmlhttp://www.fpcwrs.live/waterjava/services/trackbacks/434005.htmlҎQ?在注册表中删?/span>

q行regeditQ?扑ֈ
HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services 中想要删除的服务?/span>

 

重启电脑可以看到你所选定的服务项在服务列表中不存在了



狼爱上狸 2019-06-29 11:41 发表评论
]]>
RABBITMQ资源http://www.fpcwrs.live/paulwong/archive/2019/06/28/434001.htmlpaulwongpaulwongFri, 28 Jun 2019 02:24:00 GMThttp://www.fpcwrs.live/paulwong/archive/2019/06/28/434001.htmlhttp://www.fpcwrs.live/paulwong/comments/434001.htmlhttp://www.fpcwrs.live/paulwong/archive/2019/06/28/434001.html#Feedback0http://www.fpcwrs.live/paulwong/comments/commentRss/434001.htmlhttp://www.fpcwrs.live/paulwong/services/trackbacks/434001.htmlhttps://www.jianshu.com/p/79ca08116d57

Spring Boot 中?RabbitMQ
https://juejin.im/post/59f194e06fb9a0451329ec53






paulwong 2019-06-28 10:24 发表评论
]]>
infura的?/title><link>http://www.fpcwrs.live/waterjava/archive/2019/06/27/433997.html</link><dc:creator>狼爱上狸</dc:creator><author>狼爱上狸</author><pubDate>Thu, 27 Jun 2019 14:45:00 GMT</pubDate><guid>http://www.fpcwrs.live/waterjava/archive/2019/06/27/433997.html</guid><wfw:comment>http://www.fpcwrs.live/waterjava/comments/433997.html</wfw:comment><comments>http://www.fpcwrs.live/waterjava/archive/2019/06/27/433997.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.fpcwrs.live/waterjava/comments/commentRss/433997.html</wfw:commentRss><trackback:ping>http://www.fpcwrs.live/waterjava/services/trackbacks/433997.html</trackback:ping><description><![CDATA[https://chaindesk.cn/witbook/1/12<img src ="http://www.fpcwrs.live/waterjava/aggbug/433997.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.fpcwrs.live/waterjava/" target="_blank">狼爱上狸</a> 2019-06-27 22:45 <a href="http://www.fpcwrs.live/waterjava/archive/2019/06/27/433997.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>sol在线试http://www.fpcwrs.live/waterjava/archive/2019/06/27/433994.html狼爱上狸狼爱上狸Thu, 27 Jun 2019 13:00:00 GMThttp://www.fpcwrs.live/waterjava/archive/2019/06/27/433994.htmlhttp://www.fpcwrs.live/waterjava/comments/433994.htmlhttp://www.fpcwrs.live/waterjava/archive/2019/06/27/433994.html#Feedback0http://www.fpcwrs.live/waterjava/comments/commentRss/433994.htmlhttp://www.fpcwrs.live/waterjava/services/trackbacks/433994.html

狼爱上狸 2019-06-27 21:00 发表评论
]]>
一个DDDCZ代码http://www.fpcwrs.live/fool/archive/2019/06/27/433990.html? ?/dc:creator>? ?/author>Thu, 27 Jun 2019 09:09:00 GMThttp://www.fpcwrs.live/fool/archive/2019/06/27/433990.htmlhttp://www.fpcwrs.live/fool/comments/433990.htmlhttp://www.fpcwrs.live/fool/archive/2019/06/27/433990.html#Feedback0http://www.fpcwrs.live/fool/comments/commentRss/433990.htmlhttp://www.fpcwrs.live/fool/services/trackbacks/433990.htmlgithub上的一个java版的DDD实现的示例代? 学习DDD时看一下还是不错的?br />https://github.com/daoqidelv/community-ddd-demo.git
作者不是俺Q?/div>

]]>
How to implement JMS ReplyTo using SpringBoothttp://www.fpcwrs.live/paulwong/archive/2019/06/27/433981.htmlpaulwongpaulwongThu, 27 Jun 2019 01:20:00 GMThttp://www.fpcwrs.live/paulwong/archive/2019/06/27/433981.htmlhttp://www.fpcwrs.live/paulwong/comments/433981.htmlhttp://www.fpcwrs.live/paulwong/archive/2019/06/27/433981.html#Feedback0http://www.fpcwrs.live/paulwong/comments/commentRss/433981.htmlhttp://www.fpcwrs.live/paulwong/services/trackbacks/433981.html

Request-Response is a message-exchange-pattern. In some cases, a message producer may want the consumers to reply to a message. The JMSReplyTo header indicates which destination, if any, a JMS consumer should reply to. The JMSReplyTo header is set explicitly by the JMS client; its contents will be a javax.jms.Destination object (either Topic or Queue).

In some cases, the JMS client will want the message consumers to reply to a temporary topic or queue set up by the JMS client. When a JMS message consumer receives a message that includes a JMSReplyTo destination, it can reply using that destination. A JMS consumer is not required to send a reply, but in some JMS applications, clients are programmed to do so.

For simplicity, this pattern is typically implemented in a purely synchronous fashion, as in web service calls over HTTP, which holds a connection open and waits until the response is delivered or the timeout period expires. However, request–response may also be implemented asynchronously, with a response being returned at some unknown later time.

For more information, check here.

Now, let’s jump into the code. In Spring, there are 2 ways to implement this (at least I know of).

  1. Using JMSTemplate
  2. Using Spring Integration

For demo purpose, I used ActiveMQ. However, you can implement this in other messaging systems like IBM MQ, Rabbit MQ, Tibco EMS, etc. In this demo, I send an ObjectMessage of type Order and reply with a Shipment object.

Using JMSTemplate

  1. First, we include the required dependencies. Replace the activemq dependency with your messaging system’s jars if not using ActiveMQ

     <dependencies>
         
    <dependency>
             
    <groupId>org.springframework.boot</groupId>
             
    <artifactId>spring-boot-starter-activemq</artifactId>
         
    </dependency>
         
    <dependency>
             
    <groupId>org.apache.activemq.tooling</groupId>
             
    <artifactId>activemq-junit</artifactId>
             
    <version>${activemq.version}</version>
             
    <scope>test</scope>
         
    </dependency>
         
    <dependency>
             
    <groupId>org.springframework.boot</groupId>
             
    <artifactId>spring-boot-starter-test</artifactId>
             
    <scope>test</scope>
         
    </dependency>
     
    </dependencies>
  2. Using the default spring.activemq. properties to configure the application with the ActiveMQ. However, you can do this inside a @Configuration class as well.

     spring:
       activemq:
         broker-url: tcp://localhost:
    61616
         non-blocking-redelivery: true
         packages:
           trust-all: true    
  3. Note in the above configuration spring.activemq.packages.trust-all can be changed to spring.activemq.packages.trusted with the appropriate packages.
  4. Now spring will do it’s magic and inject all the required Beans as usual :) However, in our code, we need to EnableJms

    import org.springframework.context.annotation.Configuration;
     
    import org.springframework.jms.annotation.EnableJms;

     @EnableJms
     @Configuration
     
    public class ActiveMQConfig {

         
    public static final String ORDER_QUEUE = "order-queue";
         
    public static final String ORDER_REPLY_2_QUEUE = "order-reply-2-queue";

     }
  5. First, we will configure the Producer

     @Slf4j
     @Service
     
    public class Producer {

         @Autowired
         JmsMessagingTemplate jmsMessagingTemplate;

         @Autowired
         JmsTemplate jmsTemplate;

         
    public Shipment sendWithReply(Order order) throws JMSException {
             jmsTemplate.setReceiveTimeout(
    1000L);
             jmsMessagingTemplate.setJmsTemplate(jmsTemplate);

             Session session 
    = jmsMessagingTemplate.getConnectionFactory().createConnection()
                     .createSession(
    false, Session.AUTO_ACKNOWLEDGE);

             ObjectMessage objectMessage 
    = session.createObjectMessage(order);

             objectMessage.setJMSCorrelationID(UUID.randomUUID().toString());
             objectMessage.setJMSReplyTo(
    new ActiveMQQueue(ORDER_REPLY_2_QUEUE));
             objectMessage.setJMSCorrelationID(UUID.randomUUID().toString());
             objectMessage.setJMSExpiration(
    1000L);
             objectMessage.setJMSDeliveryMode(DeliveryMode.NON_PERSISTENT);

             
    return jmsMessagingTemplate.convertSendAndReceive(new ActiveMQQueue(ORDER_QUEUE),
                     objectMessage, Shipment.
    class); //this operation seems to be blocking + sync
         }
     }
  6. Note in the above code that, JmsMessagingTemplate is used instead of JmsTemplatebecause, we are interested in the method convertSendAndReceive. As seen in the method signature, it waits to receive the Shipment object from the consumer.
  7. Next, we can see the Receiver

     @Component
     
    public class Receiver implements SessionAwareMessageListener<Message> {

         @Override
         @JmsListener(destination 
    = ORDER_QUEUE)
         
    public void onMessage(Message message, Session session) throws JMSException {
             Order order 
    = (Order) ((ActiveMQObjectMessage) message).getObject();
             Shipment shipment 
    = new Shipment(order.getId(), UUID.randomUUID().toString());

             
    // done handling the request, now create a response message
             final ObjectMessage responseMessage = new ActiveMQObjectMessage();
             responseMessage.setJMSCorrelationID(message.getJMSCorrelationID());
             responseMessage.setObject(shipment);

             
    // Message sent back to the replyTo address of the income message.
             final MessageProducer producer = session.createProducer(message.getJMSReplyTo());
             producer.send(responseMessage);
         }
     }
  8. Using the javax.jms.Session the javax.jms.MessageProducer is created and used to send the reply message to the JMSReplyTo queue. In real life, this receiver could be a different application altogether.

Using Spring Integration

  1. First, we include the required dependencies in addition to the above dependencies

     <dependency>
       
    <groupId>org.springframework.integration</groupId>
       
    <artifactId>spring-integration-jms</artifactId>
     
    </dependency>
  2. Using the default spring.activemq. properties to configure the application with the ActiveMQ. However, you can do this inside a @Configuration class as well.

     spring:
       activemq
    :
         broker
    -url: tcp://localhost:61616
         non
    -blocking-redelivery: true
         packages
    :
           trust
    -all: true   
  3. Note in the above configuration spring.activemq.packages.trust-all can be changed to spring.activemq.packages.trusted with the appropriate packages.
  4. Next we create the required Beans for the Spring Integration.

     @EnableIntegration
     @IntegrationComponentScan
     @Configuration
     
    public class ActiveMQConfig {

         
    public static final String ORDER_QUEUE = "order-queue";
         
    public static final String ORDER_REPLY_2_QUEUE = "order-reply-2-queue";

         @Bean
         
    public MessageConverter messageConverter() {
             MappingJackson2MessageConverter converter 
    = new MappingJackson2MessageConverter();
             converter.setTargetType(MessageType.TEXT);
             converter.setTypeIdPropertyName(
    "_type");
             
    return converter;
         }

         @Bean
         
    public MessageChannel requests() {
             
    return new DirectChannel();
         }

         @Bean
         @ServiceActivator(inputChannel 
    = "requests")
         
    public JmsOutboundGateway jmsGateway(ActiveMQConnectionFactory activeMQConnectionFactory) {
             JmsOutboundGateway gateway 
    = new JmsOutboundGateway();
             gateway.setConnectionFactory(activeMQConnectionFactory);
             gateway.setRequestDestinationName(ORDER_QUEUE);
             gateway.setReplyDestinationName(ORDER_REPLY_2_QUEUE);
             gateway.setCorrelationKey(
    "JMSCorrelationID");
             gateway.setSendTimeout(
    100L);
             gateway.setReceiveTimeout(
    100L);
             
    return gateway;
         }

         @Autowired
         Receiver receiver;

         @Bean
         
    public DefaultMessageListenerContainer responder(ActiveMQConnectionFactory activeMQConnectionFactory) {
             DefaultMessageListenerContainer container 
    = new DefaultMessageListenerContainer();
             container.setConnectionFactory(activeMQConnectionFactory);
             container.setDestinationName(ORDER_QUEUE);
             MessageListenerAdapter adapter 
    = new MessageListenerAdapter(new Object() {

                 @SuppressWarnings(
    "unused")
                 
    public Shipment handleMessage(Order order) {
                     
    return receiver.receiveMessage(order);
                 }

             });
             container.setMessageListener(adapter);
             
    return container;
         }
     }
  5. Next, we will configure the MessagingGateway

     @MessagingGateway(defaultRequestChannel = "requests")
     
    public interface ClientGateway {
         Shipment sendAndReceive(Order order);
     }
  6. We then Autowire this gateway in our Component class when we want to send and receive the message. A sample is shown below.

     @Slf4j
     @Component
     
    public class Receiver {
         
    public Shipment receiveMessage(@Payload Order order) {
             Shipment shipment 
    = new Shipment(order.getId(), UUID.randomUUID().toString());
             
    return shipment;
         }
     }
  7. Next we configure the Componen to process the Order message. After successful execution, this component will send the Shipment message to the JMSReplyTo queue. In real life, this receiver could be a different application altogether.

For those, who just want to clone the code, head out to aniruthmp/jms



paulwong 2019-06-27 09:20 发表评论
]]>ACTIVE MQ高Ҏ?/title><link>http://www.fpcwrs.live/paulwong/archive/2019/06/26/433972.html</link><dc:creator>paulwong</dc:creator><author>paulwong</author><pubDate>Wed, 26 Jun 2019 06:13:00 GMT</pubDate><guid>http://www.fpcwrs.live/paulwong/archive/2019/06/26/433972.html</guid><wfw:comment>http://www.fpcwrs.live/paulwong/comments/433972.html</wfw:comment><comments>http://www.fpcwrs.live/paulwong/archive/2019/06/26/433972.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.fpcwrs.live/paulwong/comments/commentRss/433972.html</wfw:commentRss><trackback:ping>http://www.fpcwrs.live/paulwong/services/trackbacks/433972.html</trackback:ping><description><![CDATA[<a href="https://blog.51cto.com/1754966750/category17.html" target="_blank">https://blog.51cto.com/1754966750/category17.html</a><br /><img src ="http://www.fpcwrs.live/paulwong/aggbug/433972.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.fpcwrs.live/paulwong/" target="_blank">paulwong</a> 2019-06-26 14:13 <a href="http://www.fpcwrs.live/paulwong/archive/2019/06/26/433972.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ipfs和ethl合的例?/title><link>http://www.fpcwrs.live/waterjava/archive/2019/06/26/433969.html</link><dc:creator>狼爱上狸</dc:creator><author>狼爱上狸</author><pubDate>Wed, 26 Jun 2019 00:21:00 GMT</pubDate><guid>http://www.fpcwrs.live/waterjava/archive/2019/06/26/433969.html</guid><wfw:comment>http://www.fpcwrs.live/waterjava/comments/433969.html</wfw:comment><comments>http://www.fpcwrs.live/waterjava/archive/2019/06/26/433969.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.fpcwrs.live/waterjava/comments/commentRss/433969.html</wfw:commentRss><trackback:ping>http://www.fpcwrs.live/waterjava/services/trackbacks/433969.html</trackback:ping><description><![CDATA[https://github.com/tooploox/ipfs-eth-database<img src ="http://www.fpcwrs.live/waterjava/aggbug/433969.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.fpcwrs.live/waterjava/" target="_blank">狼爱上狸</a> 2019-06-26 08:21 <a href="http://www.fpcwrs.live/waterjava/archive/2019/06/26/433969.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title> 啰嗦!一分钟带你LJava的NIO和经典IO的区?/title><link>http://www.fpcwrs.live/jb2011/archive/2019/06/25/433956.html</link><dc:creator>Jack Jiang</dc:creator><author>Jack Jiang</author><pubDate>Tue, 25 Jun 2019 08:32:00 GMT</pubDate><guid>http://www.fpcwrs.live/jb2011/archive/2019/06/25/433956.html</guid><wfw:comment>http://www.fpcwrs.live/jb2011/comments/433956.html</wfw:comment><comments>http://www.fpcwrs.live/jb2011/archive/2019/06/25/433956.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.fpcwrs.live/jb2011/comments/commentRss/433956.html</wfw:commentRss><trackback:ping>http://www.fpcwrs.live/jb2011/services/trackbacks/433956.html</trackback:ping><description><![CDATA[<h1>1、引a</h1><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;">很多初涉|络~程的程序员Q在研究Java NIOQ即异步IOQ和l典IOQ也是常说的阻塞式IOQ的APIӞ很快׃发现一个问题:我什么时候应该用经典IOQ什么时候应该用NIOQ?/p><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;">在本文中Q将试用简明扼要的文字Q阐明Java NIO和经典IO之间的差异、典型用例,以及q些差异如何影响我们的网l编E或数据传输代码的设计和实现的?/p><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;">本文没有复杂理论Q也没有像网上基它文章一样千一律的复制_脓Q有的只是接地气的通俗易懂Q希望能l你带来帮助?/p><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;"><span style="color: #000000; font-family: "PingFang SC", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;">Q本文同步发布于Q?/span><a href="http://www.52im.net/thread-2635-1-1.html" target="_blank" data-mce-href="http://www.52im.net/thread-2635-1-1.html" style="font-family: "PingFang SC", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;">http://www.52im.net/thread-2635-1-1.html</a><span style="color: #000000; font-family: "PingFang SC", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;">Q?/span></p><div style="box-sizing: border-box; padding-bottom: 25px; width: 700px; margin-left: -40px; text-align: center; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff;"><div style="box-sizing: border-box; position: relative; z-index: 100; background-color: transparent; transition: background-color 0.1s linear 0s; margin: 0px auto; max-width: 600px; max-height: 338px;"><div style="box-sizing: border-box; z-index: 50; padding-bottom: 337.969px;"></div><div data-width="600" data-height="338" style="box-sizing: border-box; position: absolute; top: 0px; left: 0px; width: 600px; height: 337.969px; overflow: hidden;"><img data-original-src="http://upload-images.jianshu.io/upload_images/1500839-ebba96b917fb0245.jpeg" src="http://upload-images.jianshu.io/upload_images/1500839-ebba96b917fb0245.jpeg" data-original-width="600" data-original-height="338" data-original-format="image/jpeg" data-original-filesize="21908" style="box-sizing: border-box; border: 0px; vertical-align: middle; transition: all 0.15s linear 0s; z-index: 100; opacity: 1; max-width: 100%; height: auto; cursor: zoom-in; display: block; filter: blur(0px);" alt="" /></div></div></div><h1>2、相x?/h1><blockquote style="box-sizing: border-box; padding: 20px; margin: 0px 0px 25px; font-size: 16px; border-left-width: 6px; border-left-color: #b4b4b4; background-color: #f7f7f7; line-height: 30px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; word-break: break-word !important;"><p style="box-sizing: border-box; margin: 0px 0px 25px; line-height: 1.7; word-break: break-word !important;"></p><ul style="overflow-wrap: break-word; margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; font-family: "Helvetica Neue", Helvetica, Verdana, sans-serif, "Microsoft Yahei"; font-size: 15px; background-color: #ffffff;"><li style="overflow-wrap: break-word; margin: 0px 0px 5px 2em; padding: 0px; list-style: disc; font-size: 14px; color: #666666;">?a href="http://www.52im.net/thread-306-1-1.html" target="_blank" style="overflow-wrap: break-word; color: #0078b6; text-decoration-line: none; transition: all 0.3s ease 0s;">JavaC代网l编E模型AIO原理及LinuxpȝAIO介绍</a>?/li><li style="overflow-wrap: break-word; margin: 0px 0px 5px 2em; padding: 0px; list-style: disc; font-size: 14px; color: #666666;">?a href="http://www.52im.net/thread-1244-1-1.html" target="_blank" style="overflow-wrap: break-word; color: #0078b6; text-decoration-line: none; transition: all 0.3s ease 0s;">Java NIO基础视频教程、MINA视频教程、Netty快速入门视?[|盘下蝲]</a>?/li></ul><p style="box-sizing: border-box; margin: 0px; line-height: 1.7; word-break: break-word !important;"></p></blockquote><h1>3、Java NIO和IO的主要区?/h1><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;">下表ȝ了Java NIO和IO之间的主要区别。我在表格后面的部分中详细介绍每个区别?/p><div style="box-sizing: border-box; padding-bottom: 25px; width: 700px; margin-left: -40px; text-align: center; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff;"><div style="box-sizing: border-box; position: relative; z-index: 100; background-color: transparent; transition: background-color 0.1s linear 0s; margin: 0px auto; max-width: 700px; max-height: 167px;"><div style="box-sizing: border-box; z-index: 50; padding-bottom: 142.234px;"></div><div data-width="822" data-height="167" style="box-sizing: border-box; position: absolute; top: 0px; left: 0px; width: 700px; height: 142.234px; overflow: hidden;"><img data-original-src="http://upload-images.jianshu.io/upload_images/1500839-ee0a0dbe7ba00d41.jpg" src="http://upload-images.jianshu.io/upload_images/1500839-ee0a0dbe7ba00d41.jpg" data-original-width="822" data-original-height="167" data-original-format="image/jpeg" data-original-filesize="17001" style="box-sizing: border-box; border: 0px; vertical-align: middle; transition: all 0.15s linear 0s; z-index: 100; opacity: 1; max-width: 100%; height: auto; cursor: zoom-in; display: block; filter: blur(0px);" alt="" /></div></div></div><h4>3.1 Stream Oriented vs. Buffer Oriented</h4><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;">Java NIO和IO之间的第一个重要区别是IO是面向流的,其中NIO是面向缓冲区的。那么,q意味着什么?</p><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;">面向的Java IO意味着您可以从中一ơ读取一个或多个字节。你对读取的字节做什么取决于你。它们不会缓存在M地方。此外,您无法在中的数据中前后Ud。如果需要在从流中读取的数据中前后移动,则需要先其~存在缓冲区中?/p><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;">Java NIO的面向缓冲区的方法略有不同。数据被d~冲区,E后处理该缓冲区。你可以Ҏ需要在~冲Z前后Ud。这使你在处理过E中h更大的灵zL。但是,你还需要检查缓冲区是否包含完整处理所需的所有数据。ƈ且,你需要确保在更多数据读入缓冲区Ӟ不要覆盖未处理的缓冲区中的数据?/p><h4>3.2 Blocking vs. Non-blocking IO</h4><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;">Java IO的各U流都是blocking的。这意味着Q当U程调用readQ)或writeQ)Ӟ该线E将被阻塞,直到有一些数据要dQ或者数据被完全写入Q在此期_该线E无法执行Q何其他操作?/p><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;">Java NIO的非d模式允许U程h从通道d数据Qƈ且只获取当前可用的内容,或者根本没有数据,如果当前没有数据可用。线E可以l用其他内容,而不是在数据可供d之前保持d状态?/p><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;">非阻塞写入也是如此,U程可以h某些数据写入通道Q但不要{待它完全写入。然后线E可以lƈ在同一旉做其他事情?/p><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;">U程在IO调用中没有阻塞时pI闲旉Q通常在此期间在其他通道上执行IO。也是_单个U程现在可以理多个输入和输出通道?/p><h1>4、Selectors</h1><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;">Java NIO的选择器允许单个线E监视多个输入通道。你可以使用选择器注册多个通道Q然后用单个线E?#8220;选择”h可用于处理的输入的通道Q或者选择准备写入的通道。这U选择器机制单个U程可以L理多个通道?/p><h1>5、NIO和经典IO如何影响应用E序的设计?</h1><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;"><span style="box-sizing: border-box; font-weight: 700;">选择NIO或IO作ؓIO工具包可能会影响应用E序设计的以下方?</span></p><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;">1QAPI调用NIO或IOc;</p><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;">2Q处理数据;</p><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;">3Q用于处理数据的U程数?/p><h4>5.1 API调用</h4><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;">当然Q用NIO时的API调用看v来与使用IO时不同。这q不奇怪。而不是仅仅从例如InputStreamd字节的数据字节,必须首先数据读入缓冲区Q然后从那里q行处理?/p><h4>5.2 数据处理</h4><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;">使用UNIO设计与IO设计Ӟ数据处理也会受到影响?/p><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;">在IO设计中,您从InputStream或Reader中读取字节的数据字节。想象一下,您正在处理基于行的文本数据流?/p><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;"><span style="box-sizing: border-box; font-weight: 700;">例如Q?/span></p><blockquote style="box-sizing: border-box; padding: 20px; margin: 0px 0px 25px; font-size: 16px; border-left-width: 6px; border-left-color: #b4b4b4; background-color: #f7f7f7; line-height: 30px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; word-break: break-word !important;"><p style="box-sizing: border-box; margin: 0px 0px 25px; line-height: 1.7; word-break: break-word !important;">Name: Anna</p><p style="box-sizing: border-box; margin: 0px 0px 25px; line-height: 1.7; word-break: break-word !important;">Age: 25</p><p style="box-sizing: border-box; margin: 0px 0px 25px; line-height: 1.7; word-break: break-word !important;">Email: [url=mailto:anna@mailserver.com]anna@mailserver.com[/url]</p><p style="box-sizing: border-box; margin: 0px; line-height: 1.7; word-break: break-word !important;">Phone: 1234567890</p></blockquote><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;"><span style="box-sizing: border-box; font-weight: 700;">q个文本行流可以像这样处理:</span></p><blockquote style="box-sizing: border-box; padding: 20px; margin: 0px 0px 25px; font-size: 16px; border-left-width: 6px; border-left-color: #b4b4b4; background-color: #f7f7f7; line-height: 30px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; word-break: break-word !important;"><p style="box-sizing: border-box; margin: 0px 0px 25px; line-height: 1.7; word-break: break-word !important;">InputStream input = ... ; // get the InputStream from the client socket</p><p style="box-sizing: border-box; margin: 0px 0px 25px; line-height: 1.7; word-break: break-word !important;"><br style="box-sizing: border-box;" /></p><p style="box-sizing: border-box; margin: 0px 0px 25px; line-height: 1.7; word-break: break-word !important;">BufferedReader reader = newBufferedReader(newInputStreamReader(input));</p><p style="box-sizing: border-box; margin: 0px 0px 25px; line-height: 1.7; word-break: break-word !important;"><br style="box-sizing: border-box;" /></p><p style="box-sizing: border-box; margin: 0px 0px 25px; line-height: 1.7; word-break: break-word !important;">String nameLine   = reader.readLine();</p><p style="box-sizing: border-box; margin: 0px 0px 25px; line-height: 1.7; word-break: break-word !important;">String ageLine    = reader.readLine();</p><p style="box-sizing: border-box; margin: 0px 0px 25px; line-height: 1.7; word-break: break-word !important;">String emailLine  = reader.readLine();</p><p style="box-sizing: border-box; margin: 0px; line-height: 1.7; word-break: break-word !important;">String phoneLine  = reader.readLine();</p></blockquote><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;">注意处理状态是如何Q由E序执行的程度决定的。换句话_一旦第一个reader.readLineQ)Ҏq回Q您q定已l读取了整行文本。readLineQ)会阻塞直到读取整行,q就是原因。您q知道此行包含名U。同P当第二个readLineQ)调用q回Ӟ您知道此行包含年龄等?/p><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;">正如您所看到的,只有当有新数据要dӞE序才会q行Qƈ且对于每个步骤,您都知道该数据是什么。一旦执行的U程已经过d代码中的某个数据片段Q该U程׃会在数据中向后移动(通常不会Q?/p><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;"><span style="box-sizing: border-box; font-weight: 700;">此图中还说明了此原则Q?/span></p><div style="box-sizing: border-box; padding-bottom: 25px; width: 700px; margin-left: -40px; text-align: center; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff;"><div style="box-sizing: border-box; position: relative; z-index: 100; background-color: transparent; transition: background-color 0.1s linear 0s; margin: 0px auto; max-width: 342px; max-height: 326px;"><div style="box-sizing: border-box; z-index: 50; padding-bottom: 325.984px;"></div><div data-width="342" data-height="326" style="box-sizing: border-box; position: absolute; top: 0px; left: 0px; width: 342px; height: 325.984px; overflow: hidden;"><img data-original-src="http://upload-images.jianshu.io/upload_images/1500839-ccb5dfcd37ebdb45.jpg" src="http://upload-images.jianshu.io/upload_images/1500839-ccb5dfcd37ebdb45.jpg" data-original-width="342" data-original-height="326" data-original-format="image/jpeg" data-original-filesize="14514" style="box-sizing: border-box; border: 0px; vertical-align: middle; transition: all 0.15s linear 0s; z-index: 100; opacity: 1; max-width: 100%; height: auto; cursor: zoom-in; display: block; filter: blur(0px);" alt="" /></div></div></div><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;">▲ Java IOQ从d中d数据</p><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;"><span style="box-sizing: border-box; font-weight: 700;">NIO的实现看h会有所不同Q这是一个简化的例子Q?/span></p><blockquote style="box-sizing: border-box; padding: 20px; margin: 0px 0px 25px; font-size: 16px; border-left-width: 6px; border-left-color: #b4b4b4; background-color: #f7f7f7; line-height: 30px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; word-break: break-word !important;"><p style="box-sizing: border-box; margin: 0px 0px 25px; line-height: 1.7; word-break: break-word !important;">ByteBuffer buffer = ByteBuffer.allocate(48);</p><p style="box-sizing: border-box; margin: 0px; line-height: 1.7; word-break: break-word !important;">intbytesRead = inChannel.read(buffer);</p></blockquote><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;">注意W二行从通道d字节到ByteBuffer。当该方法调用返回时Q您不知道所需的所有数据是否都在缓冲区内。你只知道缓冲区包含一些字节,q得处理更加困难?/p><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;">惌一下,在第一ơ读取(~冲Q调用之后,是否所有读入缓冲区的内定w是半行。例如,“姓名QAn”。你能处理这些数据吗Qƈ不是的。在完成M数据的处理之前,您需要等待至一整行数据q入~冲区?/p><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;">那么你怎么知道~冲区是否包含够的数据来处理它Q好吧,你没有。找出的唯一Ҏ是查看缓冲区中的数据。结果是Q在您知道所有数据是否存在之前,您可能需要多ơ检查缓冲区中的数据。这既低效又可能在程序设计方面变得؜乱?/p><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;"><span style="box-sizing: border-box; font-weight: 700;">例如Q?/span></p><blockquote style="box-sizing: border-box; padding: 20px; margin: 0px 0px 25px; font-size: 16px; border-left-width: 6px; border-left-color: #b4b4b4; background-color: #f7f7f7; line-height: 30px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; word-break: break-word !important;"><p style="box-sizing: border-box; margin: 0px 0px 25px; line-height: 1.7; word-break: break-word !important;">ByteBuffer buffer = ByteBuffer.allocate(48);</p><p style="box-sizing: border-box; margin: 0px 0px 25px; line-height: 1.7; word-break: break-word !important;">intbytesRead = inChannel.read(buffer);</p><p style="box-sizing: border-box; margin: 0px 0px 25px; line-height: 1.7; word-break: break-word !important;">while(! bufferFull(bytesRead) ) {</p><p style="box-sizing: border-box; margin: 0px 0px 25px; line-height: 1.7; word-break: break-word !important;">    bytesRead = inChannel.read(buffer);</p><p style="box-sizing: border-box; margin: 0px; line-height: 1.7; word-break: break-word !important;">}</p></blockquote><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;">bufferFullQ)Ҏ必须跟踪d~冲区的数据量,q返回true或falseQ具体取决于~冲区是否已满。换句话_如果~冲区已准备好进行处理,则认为它已满?/p><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;">bufferFullQ)Ҏ扫描~冲区,但必Mɾ~冲Z持与调用bufferFullQ)Ҏ之前相同的状态。如果不是,则可能无法在正确的位|读入读入缓冲区的下一个数据。这不是不可能的Q但q是另一个需要注意的问题?/p><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;">如果~冲区已满,则可以对其进行处理。如果它不满Q您可能能够部分处理那里的Q何数据,如果q在您的特定情况下是有意义的。在许多情况下,它没有?/p><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;"><span style="box-sizing: border-box; font-weight: 700;">q个图中说明了is-data-in-buffer-ready循环Q?/span></p><div style="box-sizing: border-box; padding-bottom: 25px; width: 700px; margin-left: -40px; text-align: center; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff;"><div style="box-sizing: border-box; position: relative; z-index: 100; background-color: transparent; transition: background-color 0.1s linear 0s; margin: 0px auto; max-width: 421px; max-height: 297px;"><div style="box-sizing: border-box; z-index: 50; padding-bottom: 297px;"></div><div data-width="421" data-height="297" style="box-sizing: border-box; position: absolute; top: 0px; left: 0px; width: 421px; height: 297px; overflow: hidden;"><img data-original-src="http://upload-images.jianshu.io/upload_images/1500839-3abb8d1933581759.jpg" src="http://upload-images.jianshu.io/upload_images/1500839-3abb8d1933581759.jpg" data-original-width="421" data-original-height="297" data-original-format="image/jpeg" data-original-filesize="15497" style="box-sizing: border-box; border: 0px; vertical-align: middle; transition: all 0.15s linear 0s; z-index: 100; opacity: 1; max-width: 100%; height: auto; cursor: zoom-in; display: block; filter: blur(0px);" alt="" /></div></div></div><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;">▲ Java NIOQ从通道d数据Q直到所有需要的数据都在~冲Z</p><h1>6、什么时候该用NIOQ什么时候该用经典IOQ?/h1><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;">NIO允许您仅使用一个(或几个)U程来管理多个通道Q网l连接或文gQ,但成本是解析数据可能比从d中d数据时更复杂?/p><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;">如果您需要同时管理数千个打开的连接,每个只发送一些数据,例如聊天服务器,在NIO中实现服务器可能是一个优ѝ同P如果您需要与其他计算Z持大量开放连接,例如在P2P|络中,使用单个U程来管理所有出站连接可能是一个优ѝ?/p><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;"><span style="box-sizing: border-box; font-weight: 700;">此图中说明了q一个线E,多个q接设计Q?/span></p><div style="box-sizing: border-box; padding-bottom: 25px; width: 700px; margin-left: -40px; text-align: center; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff;"><div style="box-sizing: border-box; position: relative; z-index: 100; background-color: transparent; transition: background-color 0.1s linear 0s; margin: 0px auto; max-width: 293px; max-height: 252px;"><div style="box-sizing: border-box; z-index: 50; padding-bottom: 252px;"></div><div data-width="293" data-height="252" style="box-sizing: border-box; position: absolute; top: 0px; left: 0px; width: 293px; height: 252px; overflow: hidden;"><img data-original-src="http://upload-images.jianshu.io/upload_images/1500839-e4fae4fb9dbb5896.jpg" src="http://upload-images.jianshu.io/upload_images/1500839-e4fae4fb9dbb5896.jpg" data-original-width="293" data-original-height="252" data-original-format="image/jpeg" data-original-filesize="11133" style="box-sizing: border-box; border: 0px; vertical-align: middle; transition: all 0.15s linear 0s; z-index: 100; opacity: 1; max-width: 100%; height: auto; cursor: zoom-in; display: block; filter: blur(0px);" alt="" /></div></div></div><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;">▲ Java NIOQ管理多个连接的单个U程</p><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;">如果您拥有较带宽的q接Q一ơ发送大量数据,那么可能最l典的IO服务器实现可能是最合适的?/p><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;"><span style="box-sizing: border-box; font-weight: 700;">此图说明了经典的IO服务器设计:</span></p><div style="box-sizing: border-box; padding-bottom: 25px; width: 700px; margin-left: -40px; text-align: center; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff;"><div style="box-sizing: border-box; position: relative; z-index: 100; background-color: transparent; transition: background-color 0.1s linear 0s; margin: 0px auto; max-width: 500px; max-height: 235px;"><div style="box-sizing: border-box; z-index: 50; padding-bottom: 235px;"></div><div data-width="500" data-height="235" style="box-sizing: border-box; position: absolute; top: 0px; left: 0px; width: 500px; height: 235px; overflow: hidden;"><img data-original-src="http://upload-images.jianshu.io/upload_images/1500839-230f65397a072783.jpg" src="http://upload-images.jianshu.io/upload_images/1500839-230f65397a072783.jpg" data-original-width="500" data-original-height="235" data-original-format="image/jpeg" data-original-filesize="18859" style="box-sizing: border-box; border: 0px; vertical-align: middle; transition: all 0.15s linear 0s; z-index: 100; opacity: 1; max-width: 100%; height: auto; cursor: zoom-in; display: block; filter: blur(0px);" alt="" /></div></div></div><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;">▲ Java IOQ经典的IO服务器设?- ׃个线E处理的一个连?/p><h1>7、更化的理解</h1><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;">以众所周之的数据读取过Eؓ例,我们来一个更化的理解?/p><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;">对于数据dQ就d速度来说QCPU > 内存 > 盘?/p><blockquote style="box-sizing: border-box; padding: 20px; margin: 0px 0px 25px; font-size: 16px; border-left-width: 6px; border-left-color: #b4b4b4; background-color: #f7f7f7; line-height: 30px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; word-break: break-word !important;"><p style="box-sizing: border-box; margin: 0px 0px 25px; line-height: 1.7; word-break: break-word !important;">I- 是从硬盘到内存</p><p style="box-sizing: border-box; margin: 0px; line-height: 1.7; word-break: break-word !important;">O- 是从内存到盘</p></blockquote><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;"><span style="box-sizing: border-box; font-weight: 700;">W一U方式:</span>从硬盘读取数据,然后E序一直等Q数据读完后Ql你的操作。这U方式是最单的Q叫dIOQ也是l典IOQ?/p><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;"><span style="box-sizing: border-box; font-weight: 700;">W二U方式:</span>从硬盘读取数据,然后E序l箋向下执行Q等数据d完后Q通知当前E序d完成Q对g来说叫中断,对程序来说叫回调Q,然后此程序可以立卛_理读取的数据Q也可以执行完当前操作后再对d完的数据q行操作?/p><h1>8、总而言?/h1><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;">q是以数据读取ؓ例,操作pȝ是按块BlockQ块Q从盘拿数据,如同一个大脸盆Q一下子放入了一盆水。但是,?Java 使用的时候,旧的 IOQ经典IOQ确实基??Stream的,也就是虽然操作系l给我了一脸盆_但是我得用吸慢慢喝?/p><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;">׃l典IO的重重落后理念,于是QNIO 横空Z。。?/p><h1>附录Q更多NIO异步|络~程资料</h1><blockquote style="box-sizing: border-box; padding: 20px; margin: 0px 0px 25px; font-size: 16px; border-left-width: 6px; border-left-color: #b4b4b4; background-color: #f7f7f7; line-height: 30px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; word-break: break-word !important;"><p style="box-sizing: border-box; margin: 0px 0px 25px; line-height: 1.7; word-break: break-word !important;"></p><table cellspacing="0" cellpadding="0" style="overflow-wrap: break-word; empty-cells: show; border-collapse: collapse; table-layout: fixed; width: 944px; color: #2f2f2f; font-family: "Helvetica Neue", Helvetica, Verdana, sans-serif, "Microsoft Yahei"; font-size: 12px; background-color: #ffffff;"><tbody style="overflow-wrap: break-word;"><tr style="overflow-wrap: break-word;"><td id="postmessage_13006" style="overflow-wrap: break-word; font-size: 15px;">?a href="http://www.52im.net/thread-306-1-1.html" target="_blank" style="overflow-wrap: break-word; color: #0078b6; text-decoration-line: none; transition: all 0.3s ease 0s;">JavaC代网l编E模型AIO原理及LinuxpȝAIO介绍</a>?br style="overflow-wrap: break-word;" />?a href="http://www.52im.net/thread-163-1-1.html" target="_blank" style="overflow-wrap: break-word; color: #0078b6; text-decoration-line: none; transition: all 0.3s ease 0s;">有关“Z选择Netty”?1个疑问及解答</a>?br style="overflow-wrap: break-word;" />?a href="http://www.52im.net/thread-153-1-1.html" target="_blank" style="overflow-wrap: break-word; color: #0078b6; text-decoration-line: none; transition: all 0.3s ease 0s;">开源NIO框架八卦——到底是先有MINAq是先有Netty?</a>?br style="overflow-wrap: break-word;" />?a href="http://www.52im.net/thread-96-1-1.html" target="_blank" style="overflow-wrap: break-word; color: #0078b6; text-decoration-line: none; transition: all 0.3s ease 0s;">选Nettyq是MinaQ深入研I与ҎQ一Q?/a>?br style="overflow-wrap: break-word;" />?a href="http://www.52im.net/thread-101-1-1.html" target="_blank" style="overflow-wrap: break-word; color: #0078b6; text-decoration-line: none; transition: all 0.3s ease 0s;">选Nettyq是MinaQ深入研I与ҎQ二Q?/a>?br style="overflow-wrap: break-word;" />?a href="http://www.52im.net/thread-367-1-1.html" target="_blank" style="overflow-wrap: break-word; color: #0078b6; text-decoration-line: none; transition: all 0.3s ease 0s;">NIO框架入门(一)Q服务端ZNetty4的UDP双向通信Demo演示</a>?br style="overflow-wrap: break-word;" />?a href="http://www.52im.net/thread-373-1-1.html" target="_blank" style="overflow-wrap: break-word; color: #0078b6; text-decoration-line: none; transition: all 0.3s ease 0s;">NIO框架入门(?Q服务端ZMINA2的UDP双向通信Demo演示</a>?br style="overflow-wrap: break-word;" />?a href="http://www.52im.net/thread-378-1-1.html" target="_blank" style="overflow-wrap: break-word; color: #0078b6; text-decoration-line: none; transition: all 0.3s ease 0s;">NIO框架入门(?QiOS与MINA2、Netty4的跨q_UDP双向通信实战</a>?br style="overflow-wrap: break-word;" />?a href="http://www.52im.net/thread-388-1-1.html" target="_blank" style="overflow-wrap: break-word; color: #0078b6; text-decoration-line: none; transition: all 0.3s ease 0s;">NIO框架入门(?QAndroid与MINA2、Netty4的跨q_UDP双向通信实战</a>?br style="overflow-wrap: break-word;" />?a href="http://www.52im.net/thread-99-1-1.html" target="_blank" style="overflow-wrap: break-word; color: #0078b6; text-decoration-line: none; transition: all 0.3s ease 0s;">Netty 4.x学习Q一Q:ByteBuf详解</a>?br style="overflow-wrap: break-word;" />?a href="http://www.52im.net/thread-100-1-1.html" target="_blank" style="overflow-wrap: break-word; color: #0078b6; text-decoration-line: none; transition: all 0.3s ease 0s;">Netty 4.x学习Q二Q:Channel和Pipeline详解</a>?br style="overflow-wrap: break-word;" />?a href="http://www.52im.net/thread-98-1-1.html" target="_blank" style="overflow-wrap: break-word; color: #0078b6; text-decoration-line: none; transition: all 0.3s ease 0s;">Netty 4.x学习Q三Q:U程模型详解</a>?br style="overflow-wrap: break-word;" />?a href="http://www.52im.net/thread-109-1-1.html" target="_blank" style="overflow-wrap: break-word; color: #0078b6; text-decoration-line: none; transition: all 0.3s ease 0s;">Apache Mina框架高񔽋(一Q:IoFilter详解</a>?br style="overflow-wrap: break-word;" />?a href="http://www.52im.net/thread-110-1-1.html" target="_blank" style="overflow-wrap: break-word; color: #0078b6; text-decoration-line: none; transition: all 0.3s ease 0s;">Apache Mina框架高񔽋(二)QIoHandler详解</a>?br style="overflow-wrap: break-word;" />?a href="http://www.52im.net/thread-95-1-1.html" target="_blank" style="overflow-wrap: break-word; color: #0078b6; text-decoration-line: none; transition: all 0.3s ease 0s;">MINA2 U程原理ȝQ含单测试实例)</a>?br style="overflow-wrap: break-word;" />?a href="http://www.52im.net/thread-108-1-1.html" target="_blank" style="overflow-wrap: break-word; color: #0078b6; text-decoration-line: none; transition: all 0.3s ease 0s;">Apache MINA2.0 开发指南(中文版)[附g下蝲]</a>?br style="overflow-wrap: break-word;" />?a href="http://www.52im.net/thread-113-1-1.html" target="_blank" style="overflow-wrap: break-word; color: #0078b6; text-decoration-line: none; transition: all 0.3s ease 0s;">MINA、Netty的源代码Q在UKȝQ已整理发布</a>?br style="overflow-wrap: break-word;" />?a href="http://www.52im.net/thread-111-1-1.html" target="_blank" style="overflow-wrap: break-word; color: #0078b6; text-decoration-line: none; transition: all 0.3s ease 0s;">解决MINA数据传输中TCP的粘包、缺包问题(有源码)</a>?br style="overflow-wrap: break-word;" />?a href="http://www.52im.net/thread-114-1-1.html" target="_blank" style="overflow-wrap: break-word; color: #0078b6; text-decoration-line: none; transition: all 0.3s ease 0s;">解决Mina中多个同cdFilter实例共存的问?/a>?br style="overflow-wrap: break-word;" />?a href="http://www.52im.net/thread-181-1-1.html" target="_blank" style="overflow-wrap: break-word; color: #0078b6; text-decoration-line: none; transition: all 0.3s ease 0s;">实践ȝQNetty3.x升Netty4.x遇到的那些坑Q线E篇Q?/a>?br style="overflow-wrap: break-word;" />?a href="http://www.52im.net/thread-184-1-1.html" target="_blank" style="overflow-wrap: break-word; color: #0078b6; text-decoration-line: none; transition: all 0.3s ease 0s;">实践ȝQNetty3.x VS Netty4.x的线E模?/a>?br style="overflow-wrap: break-word;" />?a href="http://www.52im.net/thread-426-1-1.html" target="_blank" style="overflow-wrap: break-word; color: #0078b6; text-decoration-line: none; transition: all 0.3s ease 0s;">详解Netty的安全性:原理介绍、代码演C(上篇Q?/a>?br style="overflow-wrap: break-word;" />?a href="http://www.52im.net/thread-427-1-1.html" target="_blank" style="overflow-wrap: break-word; color: #0078b6; text-decoration-line: none; transition: all 0.3s ease 0s;">详解Netty的安全性:原理介绍、代码演C(下篇Q?/a>?br style="overflow-wrap: break-word;" />?a href="http://www.52im.net/thread-348-1-1.html" target="_blank" style="overflow-wrap: break-word; color: #0078b6; text-decoration-line: none; transition: all 0.3s ease 0s;">详解Netty的优雅退出机制和原理</a>?br style="overflow-wrap: break-word;" />?a href="http://www.52im.net/thread-400-1-1.html" target="_blank" style="overflow-wrap: break-word; color: #0078b6; text-decoration-line: none; transition: all 0.3s ease 0s;">NIO框架详解QNetty的高性能之道</a>?br style="overflow-wrap: break-word;" />?a href="http://www.52im.net/thread-97-1-1.html" target="_blank" style="overflow-wrap: break-word; color: #0078b6; text-decoration-line: none; transition: all 0.3s ease 0s;">TwitterQ如何用Netty 4来减JVM的GC开销Q译文)</a>?br style="overflow-wrap: break-word;" />?a href="http://www.52im.net/thread-166-1-1.html" target="_blank" style="overflow-wrap: break-word; color: #0078b6; text-decoration-line: none; transition: all 0.3s ease 0s;">l对q货Q基于Netty实现量接入的推送服务技术要?/a>?br style="overflow-wrap: break-word;" />?a href="http://www.52im.net/thread-1243-1-1.html" target="_blank" style="overflow-wrap: break-word; color: #0078b6; text-decoration-line: none; transition: all 0.3s ease 0s;">Nettyq货分nQ京东京麦的生UTCP|关技术实跉|ȝ</a>?br style="overflow-wrap: break-word;" />?a href="http://www.52im.net/thread-2043-1-1.html" target="_blank" style="overflow-wrap: break-word; color: #0078b6; text-decoration-line: none; transition: all 0.3s ease 0s;">新手入门Q目前ؓ止最透彻的的Netty高性能原理和框架架构解?/a>?br style="overflow-wrap: break-word;" />?a href="http://www.52im.net/thread-2190-1-1.html" target="_blank" style="overflow-wrap: break-word; color: #0078b6; text-decoration-line: none; transition: all 0.3s ease 0s;">写给初学者:Java高性能NIO框架Netty的学习方法和q阶{略</a>?br style="overflow-wrap: break-word;" />?a href="http://www.52im.net/thread-2635-1-1.html" target="_blank" style="overflow-wrap: break-word; color: #0078b6; text-decoration-line: none; transition: all 0.3s ease 0s;">啰嗦!一分钟带你LJava的NIO和经典IO的区?/a>?br style="overflow-wrap: break-word;" />>> <a href="http://www.52im.net/forum.php?mod=collection&action=view&ctid=9" target="_blank" style="overflow-wrap: break-word; color: #0078b6; text-decoration-line: none; transition: all 0.3s ease 0s;">更多同类文章 ……</a></td></tr><tr style="overflow-wrap: break-word;"><td style="overflow-wrap: break-word;"></td></tr></tbody></table><p style="box-sizing: border-box; margin: 0px; line-height: 1.7; word-break: break-word !important;"><a href="https://links.jianshu.com/go?to=http%3A%2F%2Fwww.52im.net%2Fforum.php%3Fmod%3Dcollection%26action%3Dview%26ctid%3D9" target="_blank" style="box-sizing: border-box; background-color: transparent; color: #3194d0; text-decoration-line: none; cursor: pointer;"></a></p></blockquote><p style="box-sizing: border-box; margin: 0px 0px 25px; color: #2f2f2f; font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 16px; background-color: #ffffff; word-break: break-word !important;"><span style="color: #000000; font-family: "PingFang SC", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;">Q本文同步发布于Q?/span><a href="http://www.52im.net/thread-2635-1-1.html" target="_blank" data-mce-href="http://www.52im.net/thread-2635-1-1.html" style="font-family: "PingFang SC", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;">http://www.52im.net/thread-2635-1-1.html</a><span style="color: #000000; font-family: "PingFang SC", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;">Q?/span></p><img src ="http://www.fpcwrs.live/jb2011/aggbug/433956.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.fpcwrs.live/jb2011/" target="_blank">Jack Jiang</a> 2019-06-25 16:32 <a href="http://www.fpcwrs.live/jb2011/archive/2019/06/25/433956.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>W十一?从宠物商店案例看DAPP架构和WEB3.JS交互接口http://www.fpcwrs.live/waterjava/archive/2019/06/25/433951.html狼爱上狸狼爱上狸Tue, 25 Jun 2019 03:05:00 GMThttp://www.fpcwrs.live/waterjava/archive/2019/06/25/433951.htmlhttp://www.fpcwrs.live/waterjava/comments/433951.htmlhttp://www.fpcwrs.live/waterjava/archive/2019/06/25/433951.html#Feedback0http://www.fpcwrs.live/waterjava/comments/commentRss/433951.htmlhttp://www.fpcwrs.live/waterjava/services/trackbacks/433951.html

狼爱上狸 2019-06-25 11:05 发表评论
]]>
truffle里的solc版本与实际solc版本冲突的问?/title><link>http://www.fpcwrs.live/waterjava/archive/2019/06/25/433949.html</link><dc:creator>狼爱上狸</dc:creator><author>狼爱上狸</author><pubDate>Tue, 25 Jun 2019 01:05:00 GMT</pubDate><guid>http://www.fpcwrs.live/waterjava/archive/2019/06/25/433949.html</guid><wfw:comment>http://www.fpcwrs.live/waterjava/comments/433949.html</wfw:comment><comments>http://www.fpcwrs.live/waterjava/archive/2019/06/25/433949.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.fpcwrs.live/waterjava/comments/commentRss/433949.html</wfw:commentRss><trackback:ping>http://www.fpcwrs.live/waterjava/services/trackbacks/433949.html</trackback:ping><description><![CDATA[<div> 1.因ؓsolc@0.5.1出现调用单运合U出现返?的问题,所以把solc降到?.4.22?/div><div>2.安装truffle后,npm install -g truffle,版本有所不同Q?/div><div>PS C:\> truffle version<br />Truffle v5.0.24 (core: 5.0.24)<br />Solidity v0.5.0 (solc-js)<br />Node v10.16.0<br />Web3.js v1.0.0-beta.37</div><div>3.建立单合UGreeter.sol后,利用truffle compile后,出现Q?/div><div>Error: CompileError: ParsedContract.sol:1:1: ParserError: Source file requires different compiler version (current compiler is 0.5.8+commit.23d335f2.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version<br />pragma solidity ^0.4.24;<br />^----------------------^<br /><br />Compilation failed. See above.</div><div>4.修改truffle-config.js文gQ?/div><div><pre style="background-color:#ffffff;color:#000000;font-family:'宋体';font-size:12.0pt;">module.<span style="color:#660e7a;font-weight:bold;">exports </span>= {<br /> <span style="color:#808080;font-style:italic;">// Uncommenting the defaults below <br /></span><span style="color:#808080;font-style:italic;"> // provides for an easier quick-start with Ganache.<br /></span><span style="color:#808080;font-style:italic;"> // You can also follow this format for other networks;<br /></span><span style="color:#808080;font-style:italic;"> // see <http://truffleframework.com/docs/advanced/configuration><br /></span><span style="color:#808080;font-style:italic;"> // for more details on how to specify configuration options!<br /></span><span style="color:#808080;font-style:italic;"> /*<br /></span><span style="color:#808080;font-style:italic;"> networks: {<br /></span><span style="color:#808080;font-style:italic;"> development: {<br /></span><span style="color:#808080;font-style:italic;"> host: "127.0.0.1",<br /></span><span style="color:#808080;font-style:italic;"> port: 7545,<br /></span><span style="color:#808080;font-style:italic;"> network_id: "*"<br /></span><span style="color:#808080;font-style:italic;"> },<br /></span><span style="color:#808080;font-style:italic;"> test: {<br /></span><span style="color:#808080;font-style:italic;"> host: "127.0.0.1",<br /></span><span style="color:#808080;font-style:italic;"> port: 7545,<br /></span><span style="color:#808080;font-style:italic;"> network_id: "*"<br /></span><span style="color:#808080;font-style:italic;"> }<br /></span><span style="color:#808080;font-style:italic;"> }<br /></span><span style="color:#808080;font-style:italic;"> */<br /></span><span style="color:#808080;font-style:italic;"> </span><span style="color:#660e7a;font-weight:bold;">compilers</span>: {<br /> <span style="color:#660e7a;font-weight:bold;">solc</span>: {<br /> <span style="color:#660e7a;font-weight:bold;">version</span>: <span style="color:#008000;font-weight:bold;">"0.4.24"<br /></span><span style="color:#008000;font-weight:bold;"> </span>}<br /> }<br />};<br />5.再次~译Q出?br />/C/users/administrator/webstormprojects/testtruffle/contracts/Migrations.sol:1:1: SyntaxError: Source file requires different compiler version (current compiler is 0.4.24+commit.e67f0147.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version<br />pragma solidity >=0.4.25 <0.6.0;<br />^------------------------------^<br />6.打开Migrations.sol文gQ?br />把pragma solidity >=0.4.25 <0.6.0;<br />修改为:pragma solidity >=0.4.24 <0.6.0;<br />~译通过?br /></pre></div><img src ="http://www.fpcwrs.live/waterjava/aggbug/433949.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.fpcwrs.live/waterjava/" target="_blank">狼爱上狸</a> 2019-06-25 09:05 <a href="http://www.fpcwrs.live/waterjava/archive/2019/06/25/433949.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title> ipfs + 以太坊实例解?/title><link>http://www.fpcwrs.live/waterjava/archive/2019/06/25/433948.html</link><dc:creator>狼爱上狸</dc:creator><author>狼爱上狸</author><pubDate>Tue, 25 Jun 2019 00:21:00 GMT</pubDate><guid>http://www.fpcwrs.live/waterjava/archive/2019/06/25/433948.html</guid><wfw:comment>http://www.fpcwrs.live/waterjava/comments/433948.html</wfw:comment><comments>http://www.fpcwrs.live/waterjava/archive/2019/06/25/433948.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.fpcwrs.live/waterjava/comments/commentRss/433948.html</wfw:commentRss><trackback:ping>http://www.fpcwrs.live/waterjava/services/trackbacks/433948.html</trackback:ping><description><![CDATA[本文章的目Z春哥的博客教E?br />【IPFS + 区块?pd?入门?- IPFS + Ethereum Q下)-ipfs + Ethereum 大图片存?br /><br />我个人只是作录学习心得所借鉴<br />目程<br /><br />首先调用代码创徏truffle目<br /><br />    truffle unbox react<br /><br />其次Q要引入ipfs的apiQ用作图片存储的相关功能Q我们是图片存储到ipfs当中Q而将所获得囄的hash区块链之中,区块铑֤数据成本的问?br /><br />    npm install –save ipfs-api<br /><br />安装完毕调用complie~译合约代码,Q以便用web3调用合约存储区块?br /><br />    compile<br /><br />替换合约地址Q这个需要将合约在以太坊部vq取得对应地址<br />然后q行ipfs节点<br /><br />    ipfs daemon<br /><br />启动目<br /><br />    npm start<br /><br />可以看到项目成?br />代码解读分析<br /><br />import React, {Component} from 'react'<br />import SimpleStorageContract from '../build/contracts/SimpleStorage.json'<br />import getWeb3 from './utils/getWeb3'<br /><br />import './css/oswald.css'<br />import './css/open-sans.css'<br />import './css/pure-min.css'<br />import './App.css'<br /><br />const ipfsAPI = require('ipfs-api');<br />const ipfs = ipfsAPI({host: 'localhost', port: '5001', protocol: 'http'});<br /><br />const contract = require('truffle-contract')<br />const simpleStorage = contract(SimpleStorageContract)<br />let account;<br /><br />/** Declaring this for later so we can chain functions on SimpleStorage.**/<br />let contractInstance;<br />//ipfs保存囄Ҏ//<br />let saveImageOnIpfs = (reader) => {<br />  return new Promise(function(resolve, reject) {<br />    const buffer = Buffer.from(reader.result);<br />    ipfs.add(buffer).then((response) => {<br />      console.log(response)<br />      resolve(response[0].hash);<br />    }).catch((err) => {<br />      console.error(err)<br />      reject(err);<br />    })<br />  })<br />}<br /><br />//创徏构造函敎ͼd状态机变量//<br /><br />class App extends Component {<br />  constructor(props) {<br />    super(props)<br /><br />    this.state = {<br />      blockChainHash: null,<br />      web3: null,<br />      address: null,<br />      imgHash: null,<br />      isWriteSuccess: false<br />    }<br />  }<br />//E序启动默认调用Ҏ//<br />  componentWillMount() {<br />    //打印目中网l节?/<br />    ipfs.swarm.peers(function(err, res) {<br />      if (err) {<br />        console.error(err);<br />      } else {<br />        /** var numPeers = res.Peers === null ? 0 : res.Peers.length;**/<br />        /** console.log("IPFS - connected to " + numPeers + " peers");**/<br />        console.log(res);<br />      }<br />    });<br />    //web3讄Q同时调用初始化Ҏ//<br />    getWeb3.then(results => {<br />      this.setState({web3: results.web3})<br /><br />      // Instantiate contract once web3 provided.<br />      this.instantiateContract()<br />    }).catch(() => {<br />      console.log('Error finding web3.')<br />    })<br />  }<br />    //初始化合U实例、web3获取合约账号以及合约实例//<br />  instantiateContract = () => {<br /><br />    simpleStorage.setProvider(this.state.web3.currentProvider);<br />    this.state.web3.eth.getAccounts((error, accounts) => {<br />      account = accounts[0];<br />      simpleStorage.at('0xf6a7e96860f05f21ecb4eb588fe8a8a83981af03').then((contract) => {<br />        console.log(contract.address);<br />        contractInstance = contract;<br />        this.setState({address: contractInstance.address});<br />        return;<br />      });<br />    })<br /><br />  }<br />  render() {<br />    return (<div className="App"><br />      {<br />        this.state.address<br />          ? <h1>合约地址Q{this.state.address}</h1><br />          : <div/><br />      }<br />      <h2>上传囄到IPFSQ?lt;/h2><br />      /**q一部分用于上传文g到ipfs**/<br />      <div><br />        <label id="file">Choose file to upload</label><br />        <input type="file" ref="file" id="file" name="file" multiple="multiple"/><br />      </div><br />      <div><br />        <button onClick={() => {<br />            var file = this.refs.file.files[0];<br />            var reader = new FileReader();<br />            // reader.readAsDataURL(file);<br />            reader.readAsArrayBuffer(file)<br />            reader.onloadend = function(e) {<br />              console.log(reader);<br />              saveImageOnIpfs(reader).then((hash) => {<br />                console.log(hash);<br />                this.setState({imgHash: hash})<br />              });<br /><br />            }.bind(this);<br /><br />          }}>图片上传到IPFSq返回图片HASH</button><br />      </div><br />       /**q一部分用于上传hash到区块链**/<br />      {<br />        this.state.imgHash<br />          ? <div><br />              <h2>imgHashQ{this.state.imgHash}</h2><br />              <button onClick={() => {<br />                  contractInstance.set(this.state.imgHash, {from: account}).then(() => {<br />                    console.log('囄的hash已经写入到区块链Q?);<br />                    this.setState({isWriteSuccess: true});<br />                  })<br />                }}>图片hash写到区块链:contractInstance.set(imgHash)</button><br />            </div><br />          : <div/><br />      }<br />      {<br />        this.state.isWriteSuccess<br />          ? <div><br />              <h1>囄的hash已经写入到区块链Q?lt;/h1><br />              <button onClick={() => {<br />                  contractInstance.get({from: account}).then((data) => {<br />                    console.log(data);<br />                    this.setState({blockChainHash: data});<br />                  })<br />                }}>从区块链d囄hashQcontractInstance.get()</button><br />            </div><br />          : <div/><br />      }<br />      {<br />        this.state.blockChainHash<br />          ? <div><br />              <h3>从区块链d到的hash|{this.state.blockChainHash}</h3><br />            </div><br />          : <div/><br />      }<br />      {<br />        this.state.blockChainHash<br />          ? <div><br />              <h2>览器访问:{"http://localhost:8080/ipfs/" + this.state.imgHash}</h2><br />              <img alt="" style={{width:200}} src={"http://localhost:8080/ipfs/" + this.state.imgHash}/><br />            </div><br />          : <img alt=""/><br />      }<br />    </div>);<br />  }<br />}<br /><br />export default App<br /><br /><br /><br />该项目算是truffle和ipfsl合以太坊一起用的l合案例Q用与梳理知识点<br />--------------------- <br />作者:czZ__czZ <br />来源QCSDN <br />原文Qhttps://blog.csdn.net/czZ__czZ/article/details/79036567 <br />版权声明Q本文ؓ博主原创文章Q{载请附上博文链接Q?img src ="http://www.fpcwrs.live/waterjava/aggbug/433948.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.fpcwrs.live/waterjava/" target="_blank">狼爱上狸</a> 2019-06-25 08:21 <a href="http://www.fpcwrs.live/waterjava/archive/2019/06/25/433948.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JMS消息消费的顺序?/title><link>http://www.fpcwrs.live/paulwong/archive/2019/06/24/433942.html</link><dc:creator>paulwong</dc:creator><author>paulwong</author><pubDate>Mon, 24 Jun 2019 09:42:00 GMT</pubDate><guid>http://www.fpcwrs.live/paulwong/archive/2019/06/24/433942.html</guid><wfw:comment>http://www.fpcwrs.live/paulwong/comments/433942.html</wfw:comment><comments>http://www.fpcwrs.live/paulwong/archive/2019/06/24/433942.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.fpcwrs.live/paulwong/comments/commentRss/433942.html</wfw:commentRss><trackback:ping>http://www.fpcwrs.live/paulwong/services/trackbacks/433942.html</trackback:ping><description><![CDATA[现有的系l架构都是分布式的。有多个消息的发送者和多个消息的消费者。例如订单创建消息和订单支付消息Q我们需要保证先消费订单创徏消息Q然后消费订单支付消息?br /><br />如何解决MQ消息消费序问题<br /><a href="https://segmentfault.com/a/1190000014512075" target="_blank">https://segmentfault.com/a/1190000014512075</a><br /><br />jms-如何保证消息的顺?br /><a href="https://leokongwq.github.io/2017/01/23/jms-message-order.html" target="_blank">https://leokongwq.github.io/2017/01/23/jms-message-order.html</a><br /><br /><br /><br /><br /><br /><br /><br /><img src ="http://www.fpcwrs.live/paulwong/aggbug/433942.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.fpcwrs.live/paulwong/" target="_blank">paulwong</a> 2019-06-24 17:42 <a href="http://www.fpcwrs.live/paulwong/archive/2019/06/24/433942.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>nodejs-执行报错Error: Cannot find module 'express'http://www.fpcwrs.live/waterjava/archive/2019/06/23/433936.html狼爱上狸狼爱上狸Sun, 23 Jun 2019 14:31:00 GMThttp://www.fpcwrs.live/waterjava/archive/2019/06/23/433936.htmlhttp://www.fpcwrs.live/waterjava/comments/433936.htmlhttp://www.fpcwrs.live/waterjava/archive/2019/06/23/433936.html#Feedback0http://www.fpcwrs.live/waterjava/comments/commentRss/433936.htmlhttp://www.fpcwrs.live/waterjava/services/trackbacks/433936.html
  1. C:\Users\0>node E:\目\2018q\11月䆾\nodejs\express_demo.js
  2. module.js:471
  3. throw err;
  4. ^
  5. Error: Cannot find module 'express'
  6. at Function.Module._resolveFilename (module.js:469:15)
  7. at Function.Module._load (module.js:417:25)
  8. at Module.require (module.js:497:17)
  9. at require (internal/module.js:20:19)
  10. at Object.<anonymous> (E:\目\2018q\11月䆾\nodejs\express_demo.js:1:77)
  11. at Module._compile (module.js:570:32)
  12. at Object.Module._extensions..js (module.js:579:10)
  13. at Module.load (module.js:487:32)
  14. at tryModuleLoad (module.js:446:12)
  15. at Function.Module._load (module.js:438:3)
  16. C:\Users\0>express --version
  17. 4.16.0

实际上我是有安装express模块?/p>

奇了个怪了?/p>

然后试过1U方法是q入目目录再执行安装express模块Q无?/p>

最后,原来是node_modules没有配置环境变量

配置上吧Q?/p>

1、控刉板\所有控刉杉K\pȝ\高pȝ讄\环境变量

新徏?#8216;NODE_PATH’:C:\Users\0\AppData\Roaming\npm\node_modules

 ~辑增加环境变量‘PATH’

完美~~


http://www.pianshen.com/article/837378161/




狼爱上狸 2019-06-23 22:31 发表评论
]]>
调用合约单运总返?的问?/title><link>http://www.fpcwrs.live/waterjava/archive/2019/06/23/433934.html</link><dc:creator>狼爱上狸</dc:creator><author>狼爱上狸</author><pubDate>Sun, 23 Jun 2019 10:12:00 GMT</pubDate><guid>http://www.fpcwrs.live/waterjava/archive/2019/06/23/433934.html</guid><wfw:comment>http://www.fpcwrs.live/waterjava/comments/433934.html</wfw:comment><comments>http://www.fpcwrs.live/waterjava/archive/2019/06/23/433934.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.fpcwrs.live/waterjava/comments/commentRss/433934.html</wfw:commentRss><trackback:ping>http://www.fpcwrs.live/waterjava/services/trackbacks/433934.html</trackback:ping><description><![CDATA[<pre style="background-color:#ffffff;color:#000000;font-family:'宋体';font-size:8.5pt;"><span style="color: #000080; font-weight: bold;">1.合约内容<br />pragma </span>solidity ^0.5.9;<br /><br /><span style="color:#000080;font-weight:bold;">contract </span>hello {<br /><br /> <span style="color:#000080;font-weight:bold;">function </span>mutiply(<span style="color:#000080;font-weight:bold;">uint </span>a) <span style="color:#000080;font-weight:bold;">public pure returns </span>(<span style="color:#000080;font-weight:bold;">uint </span>result) {<br /><br /> <span style="color:#000080;font-weight:bold;">return </span>a*<span style="color:#0000ff;">3</span>;<br /><br /> }<br />}<br />2.部v合约Q?br /><span style="color:#000080;font-weight:bold;">var </span>Web3 = require(<span style="color:#008000;font-weight:bold;">"web3"</span>);<br /><span style="color:#000080;font-weight:bold;">var </span>fs = require(<span style="color:#008000;font-weight:bold;">"fs"</span>);<br /><span style="color:#000080;font-weight:bold;">var </span>web3 = <span style="color:#000080;font-weight:bold;">new </span>Web3(<span style="color:#000080;font-weight:bold;">new </span>Web3.providers.HttpProvider(<span style="color:#008000;font-weight:bold;">'http://localhost:8545'</span>));<br /><span style="color:#000080;font-weight:bold;">var </span>code = <span style="color:#008000;font-weight:bold;">'0x' </span>+ fs.readFileSync(<span style="color:#008000;font-weight:bold;">"2_sol_hello.bin"</span>).toString();<br /><span style="color:#000080;font-weight:bold;">var </span>abi = JSON.parse(fs.readFileSync(<span style="color:#008000;font-weight:bold;">"2_sol_hello.abi"</span>).toString());<br /><span style="color:#000080;font-weight:bold;">var </span>contract = web3.eth.contract(abi);<br />console.log(web3.eth.accounts);<br />console.log(<span style="color:#008000;font-weight:bold;">'account balance:' </span>+ web3.eth.getBalance(web3.eth.accounts[<span style="color:#0000ff;">0</span>]))<br /><br />web3.personal.unlockAccount(web3.eth.accounts[<span style="color:#0000ff;">0</span>],<span style="color:#008000;font-weight:bold;">"123"</span>)<br /><span style="color:#000080;font-weight:bold;">var </span>contract = contract.new({from: web3.eth.accounts[<span style="color:#0000ff;">0</span>], data: code, gas: <span style="color:#0000ff;">470000</span>},<br /> <span style="color:#000080;font-weight:bold;">function</span>(e, contract){<br /> <br /> <span style="color:#000080;font-weight:bold;">if</span>(!contract.address) {<br /> console.log(<span style="color:#008000;font-weight:bold;">"已经发v交易Q交易地址Q? </span>+ contract.transactionHash + <span style="color:#008000;font-weight:bold;">"</span><span style="color:#000080;font-weight:bold;">\n</span><span style="color:#008000;font-weight:bold;">正在{待挖矿"</span>);<br /> } <span style="color:#000080;font-weight:bold;">else </span>{<br /> console.log(<span style="color:#008000;font-weight:bold;">"合约部v成功Q地址Q? </span>+ contract.address);<br /> <br /> }<br /> <br /> } <br />)<br />3.调用合约<br /><span style="color:#000080;font-weight:bold;">var </span>Web3 = require(<span style="color:#008000;font-weight:bold;">"web3"</span>);<br /><span style="color:#000080;font-weight:bold;">var </span>fs = require(<span style="color:#008000;font-weight:bold;">"fs"</span>);<br /><span style="color:#000080;font-weight:bold;">var </span>web3 = <span style="color:#000080;font-weight:bold;">new </span>Web3(<span style="color:#000080;font-weight:bold;">new </span>Web3.providers.HttpProvider(<span style="color:#008000;font-weight:bold;">'http://localhost:8545'</span>));<br /><span style="color:#000080;font-weight:bold;">var </span>abi = JSON.parse(fs.readFileSync(<span style="color:#008000;font-weight:bold;">"2_sol_hello.abi"</span>).toString());<br /><span style="color:#000080;font-weight:bold;">var </span>contract = web3.eth.contract(abi);<br /><span style="color:#000080;font-weight:bold;">var </span>instance = contract.at(<span style="color:#008000;font-weight:bold;">'0xb06846c54c6ae67102ed67ce57a357a643d1f1b8'</span>)<br />web3.personal.unlockAccount(web3.eth.accounts[<span style="color:#0000ff;">0</span>],<span style="color:#008000;font-weight:bold;">"123"</span>)<br />console.log(instance.mutiply(<span style="color:#0000ff;">12</span>).toString())<br />4.昄l果为:<br />0<br />原因Qsolc版本0.5.9太高Q可能调用的Ҏ不对?br />解决ҎQnpm install -g solc@0.4.22<br />降低版本Q然后把合约W一行改为:<br /><span style="color: #000080; font-weight: bold;">pragma </span>solidity ^0.4.22;<br />问题解决?br /><br /></pre><img src ="http://www.fpcwrs.live/waterjava/aggbug/433934.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.fpcwrs.live/waterjava/" target="_blank">狼爱上狸</a> 2019-06-23 18:12 <a href="http://www.fpcwrs.live/waterjava/archive/2019/06/23/433934.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>多维度对?ƾ主分布式MQ消息队列Q妈妈再也不担心我的技术选型?/title><link>http://www.fpcwrs.live/jb2011/archive/2019/06/21/433917.html</link><dc:creator>Jack Jiang</dc:creator><author>Jack Jiang</author><pubDate>Fri, 21 Jun 2019 07:01:00 GMT</pubDate><guid>http://www.fpcwrs.live/jb2011/archive/2019/06/21/433917.html</guid><wfw:comment>http://www.fpcwrs.live/jb2011/comments/433917.html</wfw:comment><comments>http://www.fpcwrs.live/jb2011/archive/2019/06/21/433917.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.fpcwrs.live/jb2011/comments/commentRss/433917.html</wfw:commentRss><trackback:ping>http://www.fpcwrs.live/jb2011/services/trackbacks/433917.html</trackback:ping><description><![CDATA[     摘要: 1、引a对于x通讯|来_所有的技术文章和资料都在围绕x通讯q个技术方向进行整理和分nQ这一ơ也不例外。对于即旉讯pȝQ包括IM、消息推送系l等Q来_MQ消息中g间是非常常见的基软gQ但市面上种cM多、各有所长的MQ消息中g间品,该怎么去选择Q这是个问题Q对于很多经验不的开发者来_一个公司内部用的IM聊天pȝQȝ户量也不q百十来人,动辄是Kafka、MongoDBQ美其名Cؓ?..  <a href='http://www.fpcwrs.live/jb2011/archive/2019/06/21/433917.html'>阅读全文</a><img src ="http://www.fpcwrs.live/jb2011/aggbug/433917.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.fpcwrs.live/jb2011/" target="_blank">Jack Jiang</a> 2019-06-21 15:01 <a href="http://www.fpcwrs.live/jb2011/archive/2019/06/21/433917.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Multiple MongoDB connectors with Spring Boothttp://www.fpcwrs.live/paulwong/archive/2019/06/20/433910.htmlpaulwongpaulwongThu, 20 Jun 2019 07:12:00 GMThttp://www.fpcwrs.live/paulwong/archive/2019/06/20/433910.htmlhttp://www.fpcwrs.live/paulwong/comments/433910.htmlhttp://www.fpcwrs.live/paulwong/archive/2019/06/20/433910.html#Feedback0http://www.fpcwrs.live/paulwong/comments/commentRss/433910.htmlhttp://www.fpcwrs.live/paulwong/services/trackbacks/433910.htmlhttp://blog.marcosbarbero.com/multiple-mongodb-connectors-in-spring-boot/



paulwong 2019-06-20 15:12 发表评论
]]>
以太坊(二)MAC搭徏以太坊私有链多节炚w(同一台电脑)http://www.fpcwrs.live/waterjava/archive/2019/06/20/433909.html狼爱上狸狼爱上狸Thu, 20 Jun 2019 06:47:00 GMThttp://www.fpcwrs.live/waterjava/archive/2019/06/20/433909.htmlhttp://www.fpcwrs.live/waterjava/comments/433909.htmlhttp://www.fpcwrs.live/waterjava/archive/2019/06/20/433909.html#Feedback0http://www.fpcwrs.live/waterjava/comments/commentRss/433909.htmlhttp://www.fpcwrs.live/waterjava/services/trackbacks/433909.html

狼爱上狸 2019-06-20 14:47 发表评论
]]>
web3.php Error: The method personal_newAccount does not exist/is not availablehttp://www.fpcwrs.live/waterjava/archive/2019/06/19/433900.html狼爱上狸狼爱上狸Wed, 19 Jun 2019 02:42:00 GMThttp://www.fpcwrs.live/waterjava/archive/2019/06/19/433900.htmlhttp://www.fpcwrs.live/waterjava/comments/433900.htmlhttp://www.fpcwrs.live/waterjava/archive/2019/06/19/433900.html#Feedback0http://www.fpcwrs.live/waterjava/comments/commentRss/433900.htmlhttp://www.fpcwrs.live/waterjava/services/trackbacks/433900.html很多人遇到这个问?

web3.php Error: The method personal_newAccount does not exist/is not available?/p>

其实很简单,我们只需要在geth启动时的rpc参数中设|rpcapi时包?"personal" 卛_?/p>

geth --rpc --rpcaddr 0.0.0.0 --rpcport 8545 --rpcapi eth,web3,admin,personal,net


来自Qhttp://www.bcfans.com/toutiao/redian/101819.html


我的是:
geth --identity "Water" --rpc --rpcport "8080" --rpccorsdomain "*" --datadir gethdata --port "30303" --nodiscover --rpcapi "db,eth,net,personal,web3" --networkid 1999 init genesis.json


狼爱上狸 2019-06-19 10:42 发表评论
]]>
NFS Server 架設http://www.fpcwrs.live/paulwong/archive/2019/06/18/433884.htmlpaulwongpaulwongTue, 18 Jun 2019 01:08:00 GMThttp://www.fpcwrs.live/paulwong/archive/2019/06/18/433884.htmlhttp://www.fpcwrs.live/paulwong/comments/433884.htmlhttp://www.fpcwrs.live/paulwong/archive/2019/06/18/433884.html#Feedback0http://www.fpcwrs.live/paulwong/comments/commentRss/433884.htmlhttp://www.fpcwrs.live/paulwong/services/trackbacks/433884.html
  • 安裝 nfs-utils 套g?pre>
    [root@kvm5 ~]# yum install -y nfs-utils
  • 建立 NFS 分n目錄?pre>
    [root@kvm5 ~]# mkdir /public /protected
  • 修改 NFS 分n目錄?SELinux 檔案 context?pre>
    [root@kvm5 ~]# semanage fcontext -a -t public_content_t "/public(/.*)?"
    [root@kvm5 ~]# semanage fcontext -a -t public_content_t "/protected(/.*)?"
    [root@kvm5 ~]# restorecon -Rv /public /protected
  • 考試時不用自行產?kerberos keytabQ只要依照指定的位置下載Q存攑֜目錄 /etc/ 下,且檔名必須為 krb5.keytab?pre>
    [root@kvm5 ~]# wget http://deyu.wang/kvm5.keytab -O /etc/krb5.keytab 
  • kerberos keytab 的驗證跟時間有關Qserver ?client 都必須校時?pre>
    [root@kvm5 ~]# date
    Sun Jan  7 14:50:04 CST 2018
    [root@kvm5 ~]# chronyc -a makestep
    200 OK
    200 OK
    [root@kvm5 ~]# date
    Mon Nov 20 15:53:22 CST 2017
  • ?/protected 下徏立次目錄 restrictedQ並其擁有者設定為 deyu3Q讓 deyu3 可以寫入資料?pre>
    [root@kvm5 ~]# mkdir -p  /protected/restricted 
    [root@kvm5 ~]# chown deyu3 /protected/restricted 
  • R輯a定?/etc/exportsQ分?/protected ?/public 兩個目錄E域 192.168.122.0/24?pre>
    [root@kvm5 ~]# echo '/protected 192.168.122.0/24(rw,sync,sec=krb5p)' > /etc/exports
    [root@kvm5 ~]# echo '/public 192.168.122.0/24(ro,sync)' >> /etc/exports
    [root@kvm5 ~]# vim /etc/exports
    [root@kvm5 ~]# cat /etc/exports
    /protected 192.168.122.0/24(rw,sync,sec=krb5p)
    /public 192.168.122.0/24(ro,sync)

  • NFS 掛載參數說明如下Q詳細說明請參?man 5 nfs 手冊?ol>
  • rwQread-writeQ可讀寫的Ɗ限Q?/li>
  • roQread-onlyQ唯讀的權限;
  • sec=modeQ安全認證模式;
    1. sec=sys 預設Q用本?UNIX UIDs ?GIDs 進行w䆾認證?/li>
    2. sec=krb5 使用 Kerberos V5 取代本地 UNIX UIDs ?GIDs 進行w䆾認證?/li>
    3. sec=krb5i 使用 Kerberos V5 進行w䆾認證Q資料完整性檢查,以防止數據被改?/li>
    4. sec=krb5p 使用 Kerberos V5 進行w䆾認證Q資料完整性檢查及 NFS 傌加密Q以防止數據被篡改,這是最安全的方式?/li>
  • syncQ資料同步寫入到a憶體與碟當中Q?/li>
    [root@kvm5 ~]# man 5 nfs 
  • a定使用 4.2 版本Q以匯出分n SELinux context。無適合的版?client 端掛載時會出?mount.nfs: Protocol not supported 的訊息?pre>
    [root@kvm5 ~]# vim /etc/sysconfig/nfs  sed -i 's/^\(RPCNFSDARGS=\).*$/\1\"-V 4.2\"/' /etc/sysconfig/nfs 
    [root@kvm5 ~]# grep ^RPCNFSDARGS /etc/sysconfig/nfs  RPCNFSDARGS="-V 4.2" 
  • a定開機啟動 nfs 服務QNFS server 端的服務?nfs-server ?nfs-secure-serverQ本版本只要啟動 nfs-server 同時啟?nfs-secure-serverQ而且使用 tab 鍵也不會出現 nfs-secure-server 服務Q但有些版本則是兩者分開,必須是不是兩E服務都啟動?pre>
    [root@kvm5 ~]# systemctl enable nfs-server.service nfs-secure-server.service 
  • 啟動 nfs 服務
    [root@kvm5 ~]# systemctl start nfs-server.service nfs-secure-server.service 
  • 查看目前啟動?nfs 版本Q因 server 指定使用 4.2Q若出現 -4.2 表示 nfs server 沒有成功啟動?pre>
    [root@kvm5 ~]# cat /proc/fs/nfsd/versions -2 +3 +4 +4.1 +4.2 
  • 要確?nfs-secure-server nfs-server 服務都正帔R作?pre>
    [root@kvm5 ~]# systemctl status nfs-secure-server.service nfs-server.service 
    nfs-secure-server.service - Secure NFS Server
       Loaded
    : loaded (/usr/lib/systemd/system/nfs-secure-server.service; enabled)
       Active
    : active (running) since Mon 2015-09-21 20:04:10 CST; 8s ago
      Process
    : 3075 ExecStart=/usr/sbin/rpc.svcgssd $RPCSVCGSSDARGS (code=exited, status=0/SUCCESS)
     Main PID
    : 3077 (rpc.svcgssd)
       CGroup
    : /system.slice/nfs-secure-server.service
               └─
    3077 /usr/sbin/rpc.svcgssd

    Sep 
    21 20:04:10 kvm5.deyu.wang systemd[1]: Starting Secure NFS Server
    Sep 
    21 20:04:10 kvm5.deyu.wang systemd[1]: Started Secure NFS Server.

    nfs
    -server.service - NFS Server
       Loaded
    : loaded (/usr/lib/systemd/system/nfs-server.service; enabled)
       Active
    : active (exited) since Mon 2015-09-21 20:04:10 CST; 8s ago
      Process
    : 3078 ExecStopPost=/usr/sbin/exportfs -f (code=exited, status=0/SUCCESS)
      Process
    : 3076 ExecStop=/usr/sbin/rpc.nfsd 0 (code=exited, status=0/SUCCESS)
      Process
    : 3087 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS $RPCNFSDCOUNT (code=exited, status=0/SUCCESS)
      Process
    : 3084 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
      Process
    : 3083 ExecStartPre=/usr/libexec/nfs-utils/scripts/nfs-server.preconfig (code=exited, status=0/SUCCESS)
     Main PID
    : 3087 (code=exited, status=0/SUCCESS)
       CGroup
    : /system.slice/nfs-server.service

    Sep 
    21 20:04:10 kvm5.deyu.wang systemd[1]: Starting NFS Server
    Sep 
    21 20:04:10 kvm5.deyu.wang systemd[1]: Started NFS Server.
  • 不論是否 TAB 有沒有出現提C,都同時啟動這兩個服務。CentOS 安裝版本 nfs-utils-1.3.0-8.el7.x86_64 啟動 nfs-secure-server 出現錯誤a息Q請埯 yum downgrade nfs-utils 換成 nfs-utils-1.3.0-0.el7.x86_64 套g?pre>
    [root@kvm5 ~]# rpm -qa | grep nfs-utils
    nfs-utils-1.3.0-8.el7.x86_64
    [root
    @kvm5 ~]# yum downgrade nfs-utils -y
    [root@kvm5 ~]# rpm -qa | grep nfs-utils
    nfs-utils-1.3.0-0.el7.x86_64
  • 再重新啟?nfs 服務Q並查看是否正常運作?pre>
    [root@kvm5 ~]# systemctl restart nfs-server.service nfs-secure-server.service 
  • 輸出所有設定的 nfs 分n目錄?pre>
    [root@kvm5 ~]# exportfs -arv
    exporting 192.168.122.0/24:/public
    exporting 
    192.168.122.0/24:/protected


  • paulwong 2019-06-18 09:08 发表评论
    ]]>
    windows安装web3http://www.fpcwrs.live/waterjava/archive/2019/06/17/433881.html狼爱上狸狼爱上狸Mon, 17 Jun 2019 06:26:00 GMThttp://www.fpcwrs.live/waterjava/archive/2019/06/17/433881.htmlhttp://www.fpcwrs.live/waterjava/comments/433881.htmlhttp://www.fpcwrs.live/waterjava/archive/2019/06/17/433881.html#Feedback1http://www.fpcwrs.live/waterjava/comments/commentRss/433881.htmlhttp://www.fpcwrs.live/waterjava/services/trackbacks/433881.html 1.安装web3要先安装node?/div>
    2.cmd->powershell
    3.c:\>node
      >require('web3')
    l果输出一些错误,表明q没安装web3?/div>
    4.c:\>npm install web3
    5.安装后,?/div>
     c:\>node
      >require('web3')
    输出
    [Function:Web3]
    表明web3安装好了?/div>


    狼爱上狸 2019-06-17 14:26 发表评论
    ]]>本地自动化编译、部|和调用合约http://www.fpcwrs.live/waterjava/archive/2019/06/15/433871.html狼爱上狸狼爱上狸Sat, 15 Jun 2019 15:05:00 GMThttp://www.fpcwrs.live/waterjava/archive/2019/06/15/433871.htmlhttp://www.fpcwrs.live/waterjava/comments/433871.htmlhttp://www.fpcwrs.live/waterjava/archive/2019/06/15/433871.html#Feedback0http://www.fpcwrs.live/waterjava/comments/commentRss/433871.htmlhttp://www.fpcwrs.live/waterjava/services/trackbacks/433871.html

    狼爱上狸 2019-06-15 23:05 发表评论
    ]]>
    快速了解ElectronQ新一代基于Web的跨q_桌面技?/title><link>http://www.fpcwrs.live/jb2011/archive/2019/06/14/433862.html</link><dc:creator>Jack Jiang</dc:creator><author>Jack Jiang</author><pubDate>Fri, 14 Jun 2019 03:11:00 GMT</pubDate><guid>http://www.fpcwrs.live/jb2011/archive/2019/06/14/433862.html</guid><wfw:comment>http://www.fpcwrs.live/jb2011/comments/433862.html</wfw:comment><comments>http://www.fpcwrs.live/jb2011/archive/2019/06/14/433862.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.fpcwrs.live/jb2011/comments/commentRss/433862.html</wfw:commentRss><trackback:ping>http://www.fpcwrs.live/jb2011/services/trackbacks/433862.html</trackback:ping><description><![CDATA[     摘要: 本文引用了作?#8220; ConardLi”的《用JS开发跨q_桌面应用Q从原理到实c一文部分内容,原文链接Qsegmentfault.com/a/1190000019426512Q感谢原作者的无私分n?、引a现在开发IM应用动不动就要求多端——即Android端、iOS端、PC端、Web端等QAndroid端和iOS端作ZU不同的Ud端技术,单独开?..  <a href='http://www.fpcwrs.live/jb2011/archive/2019/06/14/433862.html'>阅读全文</a><img src ="http://www.fpcwrs.live/jb2011/aggbug/433862.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.fpcwrs.live/jb2011/" target="_blank">Jack Jiang</a> 2019-06-14 11:11 <a href="http://www.fpcwrs.live/jb2011/archive/2019/06/14/433862.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>centos7 mysql数据库安装和配置http://www.fpcwrs.live/paulwong/archive/2019/06/14/433861.htmlpaulwongpaulwongFri, 14 Jun 2019 02:24:00 GMThttp://www.fpcwrs.live/paulwong/archive/2019/06/14/433861.htmlhttp://www.fpcwrs.live/paulwong/comments/433861.htmlhttp://www.fpcwrs.live/paulwong/archive/2019/06/14/433861.html#Feedback0http://www.fpcwrs.live/paulwong/comments/commentRss/433861.htmlhttp://www.fpcwrs.live/paulwong/services/trackbacks/433861.htmlhttps://www.cnblogs.com/starof/p/4680083.html

    paulwong 2019-06-14 10:24 发表评论
    ]]>
    本地搭徏以太坊私有网l?ZGanache和MetaMaskhttp://www.fpcwrs.live/waterjava/archive/2019/06/13/433858.html狼爱上狸狼爱上狸Thu, 13 Jun 2019 14:51:00 GMThttp://www.fpcwrs.live/waterjava/archive/2019/06/13/433858.htmlhttp://www.fpcwrs.live/waterjava/comments/433858.htmlhttp://www.fpcwrs.live/waterjava/archive/2019/06/13/433858.html#Feedback0http://www.fpcwrs.live/waterjava/comments/commentRss/433858.htmlhttp://www.fpcwrs.live/waterjava/services/trackbacks/433858.html
    本文主要介绍如何使用GanacheQ在本地搭徏以太坊私有网l,q进行简单的试?br />
     

        所需软g

          Ganache

    Ganache用于搭徏U有|络。在开发和试环境下,Ganache提供了非常简便的以太坊私有网l搭建方法,通过可视化界面可以直观地讄各种参数、浏览查看̎户和交易{数据?br />
    下蝲地址为:https://truffleframework.com/ganache/

            MetaMask

    MetaMask用于试U有|络。MetaMask是一个轻量的以太坊钱包Q由于它是一个Chrome插gQ因此用MetaMask可以非常方便地在览器中完成以太坊{账等操作?br />
    下蝲地址为:https://www.metamask.io

     

        操作步骤

         安装、启动Ganache

    1. 使用安装包安装即可?br />
    2. 打开E序后,会显CZ下界面,用户可以查看账户Q默认创?0个̎P、区块、交易和日志?br />
     

    3. 点击“讄”Q如下图所C,用户q可以设|绑定的ip和端口(讄?545卛_Q稍后MetaMask会用q个端口Q、̎h量以及gas限制{,点击“restart”后设|生效?br />
     

    此时QGanache已经在本行了一个以太坊U有|络Qƈl定?545端口?br />
     

        安装、启动MetaMask

    1. 把插件添加到chrome扩展E序卛_

    2. 点击Chrome中的MetaMask图标Q按照每一步提C启动MetaMask

    3. 如下图所C,讄MetaMaskq接到本地的以太坊私有网l?br />
        

    此时QMetaMask可以和本地的以太坊U有|络q行交互了?br />
     

        用MetaMask试U有|络

    1. 从Ganache创徏的̎户中选择一个导入到MetaMask?br />
        a. 在Ganache账户面选定一个̎P点击最双的小钥匙图标Q复制其U钥Qprivate keyQ?br />
        b. 在MetaMask中点d像,选择 “import account”Q弹出对话框

        c.  把复制的账户U钥填入文本框中Qƈ点击“import”

     

    此时QMetaMask可以操作这个新账户了?br />
     

    2. 用新导入的̎戯行{?br />
        a. 点击“send”按钮Q弹{账对话框

        b. 从Ganache账户面中,再选定一个其他的账户Q复制其地址

        c. 把复制的地址填入?“to” 文本框中Qƈ?#8220;amount”文本框中填入一个数|表示要{账的金额Q如 “10”Q;其它文本框默认值即?br />
        d. 点击nextQ弹{账确认框Q点?#8220;confirm”认交易

        e. 提醒转̎成功后,可以看到账户余额发生了变化,此时再{到Ganache账户面Q也可看C个̎L余额也都发生了变化?br />
     

        注意

    ׃Ganache的交易数据是在内存中操作的,q没有持久化到本地硬盘中Q因此每ơGanache重启后,其上一ơ的交易记录没有了Q都是重新开始的。重启Ganache后,再在MetaMask中{账就会发生错误,解决办法是在MetaMask讄?#8220;restart account”Q然后再操作ok了?br />
    如果想保留Ganache每一ơ运行时的交易数据,以便下一ơl用,可以使用命o行的形式ganache-cli启动GanacheQƈ指定数据存储目录
    ---------------------
    作者:BigCuttie
    来源QCSDN
    原文Qhttps://blog.csdn.net/starleelzx/article/details/82943530
    版权声明Q本文ؓ博主原创文章Q{载请附上博文链接Q?img src ="http://www.fpcwrs.live/waterjava/aggbug/433858.html" width = "1" height = "1" />

    狼爱上狸 2019-06-13 22:51 发表评论
    ]]>
    SPRING BOOT 打包部v指南http://www.fpcwrs.live/paulwong/archive/2019/06/13/433857.htmlpaulwongpaulwongThu, 13 Jun 2019 07:22:00 GMThttp://www.fpcwrs.live/paulwong/archive/2019/06/13/433857.htmlhttp://www.fpcwrs.live/paulwong/comments/433857.htmlhttp://www.fpcwrs.live/paulwong/archive/2019/06/13/433857.html#Feedback0http://www.fpcwrs.live/paulwong/comments/commentRss/433857.htmlhttp://www.fpcwrs.live/paulwong/services/trackbacks/433857.htmlhttps://segmentfault.com/a/1190000017386408

    paulwong 2019-06-13 15:22 发表评论
    ]]>
    Spring batch 的高U特?-监听Q异常处理,事务http://www.fpcwrs.live/paulwong/archive/2019/06/12/433855.htmlpaulwongpaulwongWed, 12 Jun 2019 09:03:00 GMThttp://www.fpcwrs.live/paulwong/archive/2019/06/12/433855.htmlhttp://www.fpcwrs.live/paulwong/comments/433855.htmlhttp://www.fpcwrs.live/paulwong/archive/2019/06/12/433855.html#Feedback0http://www.fpcwrs.live/paulwong/comments/commentRss/433855.htmlhttp://www.fpcwrs.live/paulwong/services/trackbacks/433855.htmlhttps://my.oschina.net/u/2600078/blog/909346

    paulwong 2019-06-12 17:03 发表评论
    ]]>
    LINUX安装NFShttp://www.fpcwrs.live/paulwong/archive/2019/06/12/433854.htmlpaulwongpaulwongWed, 12 Jun 2019 07:24:00 GMThttp://www.fpcwrs.live/paulwong/archive/2019/06/12/433854.htmlhttp://www.fpcwrs.live/paulwong/comments/433854.htmlhttp://www.fpcwrs.live/paulwong/archive/2019/06/12/433854.html#Feedback0http://www.fpcwrs.live/paulwong/comments/commentRss/433854.htmlhttp://www.fpcwrs.live/paulwong/services/trackbacks/433854.html https://qizhanming.com/blog/2018/08/08/how-to-install-nfs-on-centos-7

    How to fix "mountd: refused mount request: unmatched host"
    https://www.golinuxhub.com/2016/09/how-to-fix-mountd-refused-mount-request.html

    nfs讄固定端口q添加防火墙规则
    https://www.centos.bz/2017/12/nfs%E8%AE%BE%E7%BD%AE%E5%9B%BA%E5%AE%9A%E7%AB%AF%E5%8F%A3%E5%B9%B6%E6%B7%BB%E5%8A%A0%E9%98%B2%E7%81%AB%E5%A2%99%E8%A7%84%E5%88%99/

    a
    NFS Server 架設

    https://dywang.csie.cyut.edu.tw/dywang/rhce7/node60.html

    paulwong 2019-06-12 15:24 发表评论
    ]]>
    webstrom下蝲安装http://www.fpcwrs.live/waterjava/archive/2019/06/11/433853.html狼爱上狸狼爱上狸Tue, 11 Jun 2019 02:04:00 GMThttp://www.fpcwrs.live/waterjava/archive/2019/06/11/433853.htmlhttp://www.fpcwrs.live/waterjava/comments/433853.htmlhttp://www.fpcwrs.live/waterjava/archive/2019/06/11/433853.html#Feedback0http://www.fpcwrs.live/waterjava/comments/commentRss/433853.htmlhttp://www.fpcwrs.live/waterjava/services/trackbacks/433853.html 1.https://www.jetbrains.com/webstorm/download/ 下蝲2019.1.3?/div>

    2.在网盘开发Y件下载JetbrainsCrack3.4.jar、汉化包和激zȝ软g?/div>
    3.解压的.jar 破解补丁攑֜你的安装idea下面的bin的目录下面。如C:\JetBrains\WebStorm\bin
    4.在安装的idea下面的bin目录下面?个文?Q?一个是webstorm.exe.vmoptionsQ还有一个是webstorm64.exe.vmoptions。用C本打开 分别在最下面一行增加一行:
    -javaagent:C:\JetBrains\WebStorm\bin\JetbrainsCrack3.4.jar
    5.重启一下YӞ在进入出现有active code选择界面的时候,打开Ȁzȝ.txt文gQ输入即可,能够q入应用界面则表C安装破解成?hr />


    狼爱上狸 2019-06-11 10:04 发表评论
    ]]>安装intelliJ IDEA2018.3http://www.fpcwrs.live/waterjava/archive/2019/06/11/433852.html狼爱上狸狼爱上狸Tue, 11 Jun 2019 01:33:00 GMThttp://www.fpcwrs.live/waterjava/archive/2019/06/11/433852.htmlhttp://www.fpcwrs.live/waterjava/comments/433852.htmlhttp://www.fpcwrs.live/waterjava/archive/2019/06/11/433852.html#Feedback3http://www.fpcwrs.live/waterjava/comments/commentRss/433852.htmlhttp://www.fpcwrs.live/waterjava/services/trackbacks/433852.html 1.https://www.jetbrains.com/idea/download/previous.html 下蝲2018.3.6版本Q?/div>

    2.在网盘开发Y件下载JetbrainsCrack_jb51.rar软gQ里面包含了JetbrainsCrack-4.2-release-enc.jar文g?/div>
    3.解压的.jar 破解补丁攑֜你的安装idea下面的bin的目录下面。如C:\JetBrains\IntelliJ\bin
    4.在安装的idea下面的bin目录下面?个文?Q?一个是idea64.exe.vmoptionsQ还有一个是idea.exe.vmoptions。用C本打开 分别在最下面一行增加一行:
    -javaagent:C:\JetBrains\IntelliJ\bin\JetbrainsCrack-4.2-release-enc.jar
    5.重启一下YӞ在进入出现有active code选择界面的时候,随便输入几个字母卛_Q能够进入应用界面则表示安装破解成功?/div>

    狼爱上狸 2019-06-11 09:33 发表评论
    ]]>zip4jhttp://www.fpcwrs.live/paulwong/archive/2019/06/10/433851.htmlpaulwongpaulwongMon, 10 Jun 2019 08:47:00 GMThttp://www.fpcwrs.live/paulwong/archive/2019/06/10/433851.htmlhttp://www.fpcwrs.live/paulwong/comments/433851.htmlhttp://www.fpcwrs.live/paulwong/archive/2019/06/10/433851.html#Feedback0http://www.fpcwrs.live/paulwong/comments/commentRss/433851.htmlhttp://www.fpcwrs.live/paulwong/services/trackbacks/433851.htmlhttps://rensanning.iteye.com/blog/1836727



    paulwong 2019-06-10 16:47 发表评论
    ]]>
    Ubuntu16 升nodejs版本http://www.fpcwrs.live/waterjava/archive/2019/06/10/433850.html狼爱上狸狼爱上狸Mon, 10 Jun 2019 03:07:00 GMThttp://www.fpcwrs.live/waterjava/archive/2019/06/10/433850.htmlhttp://www.fpcwrs.live/waterjava/comments/433850.htmlhttp://www.fpcwrs.live/waterjava/archive/2019/06/10/433850.html#Feedback0http://www.fpcwrs.live/waterjava/comments/commentRss/433850.htmlhttp://www.fpcwrs.live/waterjava/services/trackbacks/433850.html
    Ubuntu16下,使用apt-get下蝲的nodejs最新版本ؓv4.2.6Q而react-native需要v8.x及以上的版本
    解决Ҏ

    在网上找Cq一博客Ubuntu安装最新版nodejsQ用npm安装了Node工具包nQ用该工具包将nodejs安装C目前的最新版本v10.6.0。在已经安装npm的基上,具体操作如下Q?br />
    sudo npm install n -g

    sudo n stable

    node -v

    n是一个Node工具包,它提供了几个升命o参数Q?br />
    n 昄已安装的Node版本
    n latest 安装最新版本Node
    n stable 安装最新稳定版Node
    n lts 安装最新长期维护版(lts)Node
    n version Ҏ提供的版本号安装Node
    ---------------------
    作者:LDY_T
    来源QCSDN
    原文Qhttps://blog.csdn.net/u010277553/article/details/80938829
    版权声明Q本文ؓ博主原创文章Q{载请附上博文链接Q?img src ="http://www.fpcwrs.live/waterjava/aggbug/433850.html" width = "1" height = "1" />

    狼爱上狸 2019-06-10 11:07 发表评论
    ]]>
    献给那些安装remix-ide一直不成功的windows用户http://www.fpcwrs.live/waterjava/archive/2019/06/10/433849.html狼爱上狸狼爱上狸Mon, 10 Jun 2019 01:47:00 GMThttp://www.fpcwrs.live/waterjava/archive/2019/06/10/433849.htmlhttp://www.fpcwrs.live/waterjava/comments/433849.htmlhttp://www.fpcwrs.live/waterjava/archive/2019/06/10/433849.html#Feedback0http://www.fpcwrs.live/waterjava/comments/commentRss/433849.htmlhttp://www.fpcwrs.live/waterjava/services/trackbacks/433849.html

    首先扑ֈ~译器git地址Q?a href="https://github.com/ethereum/remix-ide" target="_blank" rel="nofollow">https://github.com/ethereum/remix-ideQ?/p>

    q来后有安装步骤

    /home/water/下蝲/3486521-922a751008a61222.png
    remix-ide.png

    如果我们电脑上没有node.js先登录下面的|址安装
    https://docs.npmjs.com/getting-started/installing-node
    因ؓ安装的过E中需要的权限功能比较多所以得用管理员执行powershell 不徏议用cmd操作
    安装好之后查看自q 输入命onpm -v Q查看npm版本号如果低?.1.0。输?npm install npm@latest -g 升npm版本Pq个版本比较E_
    然后执行npm install remix-ide -g
    接着执行remix-ide
    dhttp://127.0.0.1:8080
    如果不成?执行 npm install --global --production windows-build-tools
    然后再执行上面的步骤八成可以了Qremix-ide需要的环境q挺?/p>



    作者:刘阿?br />链接Qhttps://www.jianshu.com/p/fb198cd619b9
    来源Q简?br />书著作权归作者所有,M形式的{载都误pM者获得授权ƈ注明出处?/div>

    狼爱上狸 2019-06-10 09:47 发表评论
    ]]>
    windows之geth账户建立http://www.fpcwrs.live/waterjava/archive/2019/06/08/433848.html狼爱上狸狼爱上狸Sat, 08 Jun 2019 11:18:00 GMThttp://www.fpcwrs.live/waterjava/archive/2019/06/08/433848.htmlhttp://www.fpcwrs.live/waterjava/comments/433848.htmlhttp://www.fpcwrs.live/waterjava/archive/2019/06/08/433848.html#Feedback0http://www.fpcwrs.live/waterjava/comments/commentRss/433848.htmlhttp://www.fpcwrs.live/waterjava/services/trackbacks/433848.html 建立新̎P最好用>personal.newAccount();
    而不要用C:\Users\Administrator\geth account new 命oQ?/div>
    不然账户地址建立在C:\Users\Administrator\AppData\Roaming\Ethereum\keystore下,而不是在
    C:\Users\Administrator\test\keystoreQ从而挖矿时出现错误?/div>

    狼爱上狸 2019-06-08 19:18 发表评论
    ]]> ħǹ