<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    paulwong

    #

    LINUX配置DNS

    vi /etc/resolv.conf

    nameserver 8.8.8.8

    posted @ 2019-10-10 10:55 paulwong 閱讀(330) | 評論 (0)編輯 收藏

    在SPRING INTEGRATION中手動開始和停止JMS LISTENER

    如果要對JMS BROKER生產(chǎn)和消費MESSAGE,一種方式是用JmsTemplate發(fā)送和消費消息,另一種方式是SPRING INTEGRATION。

    SPRING INTEGRATION是實現(xiàn)了EIP模式的一種框架,即使用CHANNEL和JMS-INBOUND-ADAPTER、JMS-OUTBOUND-ADAPTER,完全脫離了JmsTemplate的API。

    如果需要實現(xiàn)這種場景:從BROKER取一條消息,處理消息,且處理途中不要再從BROKER再取消息,處理完后再取消息,再處理。

    這樣要求手動開始和停止JMS LISTENER,即手動開始和停止JMS-INBOUND-ADAPTER、JMS-OUTBOUND-ADAPTER。

    @Bean
    @InboundChannelAdapter(value = "loaderResponseChannel")
    public MessageSource loaderResponseSource() throws Exception {
        return Jms
                .inboundAdapter(oracleConnectionFactory())
                .configureJmsTemplate(
                        t -> t.deliveryPersistent(true)
                                .jmsMessageConverter(jacksonJmsMessageConverter())
                ).destination(jmsInbound).get();
    }

    當(dāng)使用@InboundChannelAdapter時,會自動注冊一個SourcePollingChannelAdapter ,但這個名字比較長:configrationName.loaderResponseSource.inboundChannelAdapter。

    呼叫這個實例的start()和stop()方法即可。

    @Bean
    public IntegrationFlow controlBusFlow() {
        return IntegrationFlows.from("controlBus")
                  .controlBus()
                  .get();
    }

    Message operation = MessageBuilder.withPayload("@configrationName.loaderResponseSource.inboundChannelAdapter.start()").build();
    operationChannel.send(operation)

    https://stackoverflow.com/questions/45632469/shutdown-spring-integration-with-jms-inboundadapter

    https://docs.spring.io/spring-integration/docs/5.0.7.RELEASE/reference/html/system-management-chapter.html#control-bus

    https://github.com/spring-projects/spring-integration-java-dsl/blob/master/src/test/java/org/springframework/integration/dsl/test/jms/JmsTests.java

    https://stackoverflow.com/questions/50428552/how-to-stop-or-suspend-polling-after-batch-job-fail

    posted @ 2019-10-09 17:16 paulwong 閱讀(617) | 評論 (0)編輯 收藏

    CountDownLatch、CyclicBarrier和Semaphore

    CountDownLatch、CyclicBarrier和Semaphore這三個并發(fā)輔助類,可以在線程中呼叫,使得線程暫停等,但各有不同。

    • CountDownLatch
    1、初始化,并傳入計數(shù)器
    2、向不同的線程傳入CountDownLatch實例
    3、如果在某一線程中呼叫await(),則此線程被掛起,直到計數(shù)器為0,才往下執(zhí)行
    4、如果在某一線程中呼叫countDown(),計數(shù)器減1
    5、最終如果計數(shù)器值為0時,則CountDownLatch實例不再起作用了,即為一次性的

    • CyclicBarrier
    1、初始化,并傳入計數(shù)器值,也可傳入一個Runnable類,會在計數(shù)器為0時,被執(zhí)行
    2、向不同的線程傳入CyclicBarrier實例
    3、如果在某一線程中呼叫await(),則此線程被掛起,直到計數(shù)器為0,才往下執(zhí)行
    4、其他線程呼叫await(),則此線程被掛起,直到計數(shù)器為0,才往下執(zhí)行
    5、最終如果計數(shù)器值為0時,則CyclicBarrier實例會將計數(shù)器值恢復(fù),又可重用

    • Semaphore
    1、初始化,并傳入計數(shù)器值
    2、向不同的線程傳入Semaphore實例
    3、如果在某一線程中呼叫acquire(),則Semaphore實例會將計數(shù)器值減1,如果計數(shù)器值為-1,則將計數(shù)器值置為0,此線程被掛起,直到計數(shù)器值大于1時,才往下執(zhí)行
    4、此線程需呼叫release(),使得計數(shù)器值+1,以便其他線程在計數(shù)器值為0時不受阻


    CountDownLatch 例子:
    public class Test {
         public static void main(String[] args) {   
             final CountDownLatch latch = new CountDownLatch(2);
              
             new Thread(){
                 public void run() {
                     try {
                         System.out.println("子線程"+Thread.currentThread().getName()+"正在執(zhí)行");
                        Thread.sleep(3000);
                        System.out.println("子線程"+Thread.currentThread().getName()+"執(zhí)行完畢");
                        latch.countDown();
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                 };
             }.start();
              
             new Thread(){
                 public void run() {
                     try {
                         System.out.println("子線程"+Thread.currentThread().getName()+"正在執(zhí)行");
                         Thread.sleep(3000);
                         System.out.println("子線程"+Thread.currentThread().getName()+"執(zhí)行完畢");
                         latch.countDown();
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                 };
             }.start();
              
             try {
                 System.out.println("等待2個子線程執(zhí)行完畢");
                latch.await();
                System.out.println("2個子線程已經(jīng)執(zhí)行完畢");
                System.out.println("繼續(xù)執(zhí)行主線程");
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
         }
    }

    結(jié)果:
    線程Thread-0正在執(zhí)行
    線程Thread-1正在執(zhí)行
    等待2個子線程執(zhí)行完畢
    線程Thread-0執(zhí)行完畢
    線程Thread-1執(zhí)行完畢
    2個子線程已經(jīng)執(zhí)行完畢
    繼續(xù)執(zhí)行主線程


    CyclicBarrier例子:
    public class Test {
        public static void main(String[] args) {
            int N = 4;
            CyclicBarrier barrier  = new CyclicBarrier(N,new Runnable() {
                @Override
                public void run() {
                    System.out.println("當(dāng)前線程"+Thread.currentThread().getName());   
                }
            });
             
            for(int i=0;i<N;i++)
                new Writer(barrier).start();
        }
        static class Writer extends Thread{
            private CyclicBarrier cyclicBarrier;
            public Writer(CyclicBarrier cyclicBarrier) {
                this.cyclicBarrier = cyclicBarrier;
            }
     
            @Override
            public void run() {
                System.out.println("線程"+Thread.currentThread().getName()+"正在寫入數(shù)據(jù)");
                try {
                    Thread.sleep(5000);      //以睡眠來模擬寫入數(shù)據(jù)操作
                    System.out.println("線程"+Thread.currentThread().getName()+"寫入數(shù)據(jù)完畢,等待其他線程寫入完畢");
                    cyclicBarrier.await();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }catch(BrokenBarrierException e){
                    e.printStackTrace();
                }
                System.out.println("所有線程寫入完畢,繼續(xù)處理其他任務(wù)");
            }
        }
    }

    執(zhí)行結(jié)果:
    線程Thread-0正在寫入數(shù)據(jù)
    線程Thread-1正在寫入數(shù)據(jù)
    線程Thread-2正在寫入數(shù)據(jù)
    線程Thread-3正在寫入數(shù)據(jù)
    線程Thread-0寫入數(shù)據(jù)完畢,等待其他線程寫入完畢
    線程Thread-1寫入數(shù)據(jù)完畢,等待其他線程寫入完畢
    線程Thread-2寫入數(shù)據(jù)完畢,等待其他線程寫入完畢
    線程Thread-3寫入數(shù)據(jù)完畢,等待其他線程寫入完畢
    當(dāng)前線程Thread-3
    所有線程寫入完畢,繼續(xù)處理其他任務(wù)
    所有線程寫入完畢,繼續(xù)處理其他任務(wù)
    所有線程寫入完畢,繼續(xù)處理其他任務(wù)
    所有線程寫入完畢,繼續(xù)處理其他任務(wù)


    Semaphore例子:
    public class Test {
        public static void main(String[] args) {
            int N = 8;            //工人數(shù)
            Semaphore semaphore = new Semaphore(5); //機器數(shù)目
            for(int i=0;i<N;i++)
                new Worker(i,semaphore).start();
        }
         
        static class Worker extends Thread{
            private int num;
            private Semaphore semaphore;
            public Worker(int num,Semaphore semaphore){
                this.num = num;
                this.semaphore = semaphore;
            }
             
            @Override
            public void run() {
                try {
                    semaphore.acquire();
                    System.out.println("工人"+this.num+"占用一個機器在生產(chǎn)");
                    Thread.sleep(2000);
                    System.out.println("工人"+this.num+"釋放出機器");
                    semaphore.release();           
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    }

    執(zhí)行結(jié)果:
    工人0占用一個機器在生產(chǎn)
    工人1占用一個機器在生產(chǎn)
    工人2占用一個機器在生產(chǎn)
    工人4占用一個機器在生產(chǎn)
    工人5占用一個機器在生產(chǎn)
    工人0釋放出機器
    工人2釋放出機器
    工人3占用一個機器在生產(chǎn)
    工人7占用一個機器在生產(chǎn)
    工人4釋放出機器
    工人5釋放出機器
    工人1釋放出機器
    工人6占用一個機器在生產(chǎn)
    工人3釋放出機器
    工人7釋放出機器
    工人6釋放出機器

    https://www.cnblogs.com/dolphin0520/p/3920397.html

    https://juejin.im/post/5aeec3ebf265da0ba76fa327

    posted @ 2019-09-24 10:18 paulwong 閱讀(336) | 評論 (0)編輯 收藏

    使用 Jenkins 部署 Spring Boot

    https://mp.weixin.qq.com/s?__biz=MzI4NDY5Mjc1Mg==&mid=2247489278&idx=2&sn=a48342d706bfd1651e277e1c24e81e3e&chksm=ebf6ce81dc81479764d1e6ff7b207257a78d52bed5ef8c2f16c76f70660d1da9609167ed7bbb&mpshare=1&scene=1&srcid=&sharer_sharetime=1568861026830&sharer_shareid=24856bf403968a883e437b859be0a9b5&pass_ticket=qB9yWQbj%2FGo7PDZNogjBwishDCx5Suu%2BvBWnS1TpKmY%3D#rd

    posted @ 2019-09-19 17:44 paulwong 閱讀(342) | 評論 (0)編輯 收藏

    CI/CD 資源

    Continuous delivery tool landscape
    http://www.jamesbowman.me/post/continuous-delivery-tool-landscape/

    posted @ 2019-09-18 17:08 paulwong 閱讀(393) | 評論 (0)編輯 收藏

    ANSIBLE + SPRING BOOT

    https://github.com/remyma/ansible-springboot

    frontend+backend+jenkins+ansible
    https://itnext.io/ci-cd-with-jenkins-and-ansible-f41ef2b33977

    posted @ 2019-09-18 16:09 paulwong 閱讀(428) | 評論 (0)編輯 收藏

    Windows終端工具_MobaXterm

    前言

      有人喜歡小而美的工具,有人喜歡大集成工具。這里推薦一款增強型的Windows終端工具MobaXterm,它提供所有重要的遠程網(wǎng)絡(luò)工具(SSH,X11,RDP,VNC,F(xiàn)TP,MOSH ......)和Unix命令(bash,ls,cat,sed,grep,awk,rsync等)。使用MobaXterm工具,可以替代SSH客戶端工具(xshell、putty、securecrt等)、sftp/ftp工具(winscp、filezilla)、遠程桌面訪問工具(RDO等)等等,可以極大降低你windows系統(tǒng)上的軟件安裝數(shù)量。

    MobaXterm使用體會&優(yōu)點

      1、工具獲取簡單、免安裝(綠色版)、免費(不用到處找license)、可個性化配置(字體、前景色、背景色、語法高亮等)。

      2、可以替代xshell、putty、securecrt等SSH客戶端、winscp、filezilla等ftp傳輸工具、替代RDO遠程桌面訪問工具等。減少windows系統(tǒng)軟件安裝和資源占用。我的系統(tǒng)已經(jīng)超負(fù)荷運轉(zhuǎn)

      3、可以替代CMD窗口。CMD命令行字體太丑。。并且配置還麻煩。實在不想用。

      4、支持Unix/Linux常用命令使用。滿足在windows上學(xué)習(xí)操作linux命令的需求以及利用linux命令快速處理文本文件。

      5、可以支持豐富的組件,減少部分軟件的安裝。如Cygwin。

      工具使用建議:每個人對工具使用的要求和場景不盡相同。需要了解MobaXterm特性可以進入MobaXterm官網(wǎng)或者閱讀MobaXterm幫助手冊(啟動工具--> 菜單欄"help" -> "document")。

    MobaXterm主要功能

      1、遠程會話管理器:單個應(yīng)用程序中的SSH,SFTP,telnet,VNC,Mosh,RDP連接

      2、Windows上的許多Unix/Linux命令:基本Cygwin命令(bash,grep,awk,sed,rsync,...)。

      3、豐富的組件和插件,可以自由選擇。詳情查看MobaXterm Plugins

      4、遠程桌面:使用RDP,VNC或XDMCP在計算機上顯示完整的遠程桌面

      5、嵌入式Xserver:在Windows計算機上顯示遠程應(yīng)用程序

      6、....

    MobaXterm工具下載

      MobaXterm工具分為便攜版(綠色免安裝版,免費)和專業(yè)版(收費)。對于大部分開發(fā)測試人員,免費的綠色免安裝版本就可以滿足日常工作的需求。下載路徑:MobaXterm

    MobaXterm使用技巧

    1、執(zhí)行cmd命令快速切換執(zhí)行DOS指令??梢詧?zhí)行exit退回原界面。

    2、MobaXterm界面風(fēng)格、主體、字體以及相關(guān)快捷方式設(shè)置。MobaXterm --> Settings --> Configuration

    3、MobaXterm取消自動斷開SSH會話。

    posted @ 2019-09-11 13:19 paulwong 閱讀(383) | 評論 (0)編輯 收藏

    nohup命令不輸出OUTPUT到實體文件

    https://stackoverflow.com/questions/10408816/how-do-i-use-the-nohup-command-without-getting-nohup-out

    posted @ 2019-09-06 10:15 paulwong 閱讀(487) | 評論 (0)編輯 收藏

    MONGODB拓展操作

    MongoTemplate使用Cursor處理大數(shù)量的數(shù)據(jù)
    https://blog.csdn.net/ClementAD/article/details/55210973

    Spring Data MongoDB系列之三:數(shù)據(jù)庫批量操作
    https://blog.csdn.net/sinat_24044957/article/details/80646292

    Distinct in Spring Data MongoDB
    https://stackoverflow.com/questions/19203724/distinct-in-spring-data-mongodb

    MONGODB SQL語句
    http://www.runoob.com/mongodb/mongodb-indexing.html


    posted @ 2019-09-03 15:52 paulwong 閱讀(330) | 評論 (0)編輯 收藏

    MAVEN中SCOPE為SYSTEM的JAR包如何打包?

    https://stackoverflow.com/questions/2065928/maven-2-assembly-with-dependencies-jar-under-scope-system-not-included

    在pom.xml中加入REPOSITRY:
    <repositories>
      <repository>
        <id>my</id>
        <url>file://${basedir}/my-repo</url>
      </repository>
    </repositories>

    file://${basedir}/my-repo 中放JAR包的結(jié)構(gòu)要和MAVEN庫.m2中保持一致。

    DEPENDENCY還是按正常的來,不加SYSTEM SCOPE:
    <dependency>
      <groupId>sourceforge.jchart2d</groupId>
      <artifactId>jchart2d</artifactId>
      <version>3.1.0</version>
    </dependency>


    這里涉及到一個問題:如何將JAR比較優(yōu)雅地放到file://${basedir}/my-repo 中,可以使用deploy,如果JAR包不是由MAVEN打出來的,命令如下:
    mvn deploy:deploy-file 
    -DgroupId={yourProject} \ 
    -DartifactId={yourProject}\
    -Dfile={yourFile}\ // jar 包路徑
    -Durl={URL} \// 私服URL
    -DrepositoryId=releases\
    -Dpackaging=jar\ // 指定格式,如果不寫,一句 pom 文件中
    -DpomFile=pom.xml // 指定該 jar 包的 pom 文件,如不指定,將生成一個默認(rèn)的 pom——導(dǎo)致不可用

    如果JAR包是由MAVEN打出來的,命令如下:
    mvn deploy:deploy-file 
    -Dfile={yourFile}\ // jar 包路徑
    -Durl=file://${basedir}/my-repo
    -DpomFile=pom.xml // 指定該 jar 包的 pom 文件,如不指定,將生成一個默認(rèn)的 pom——導(dǎo)致不可用

    MAVEN DEPLOY PLUGIN:
    <plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-deploy-plugin</artifactId>
       <version>2.8.2</version>
       <executions>
          <execution>
             <id>default-cli</id>
             <phase>package</phase>
             <goals>
                <goal>deploy-file</goal>
             </goals>
             <configuration>
                <file>target/COMPOSANT-A-1.0.tar.gz</file>
                <repositoryId>nexus</repositoryId>
                <groupId>COMPOSANTS</groupId>
                <artifactId>COMPOSANT-A</artifactId>
                <version>1.0</version>
                <generatePom>false</generatePom>
                <packaging>tar.gz</packaging>
                <url>http://urlRepo:8080/nexus/content/repositories/snapshots</url>
             </configuration>
          </execution>
       </executions>
    </plugin>

    posted @ 2019-08-27 17:32 paulwong 閱讀(2013) | 評論 (0)編輯 收藏

    僅列出標(biāo)題
    共115頁: First 上一頁 23 24 25 26 27 28 29 30 31 下一頁 Last 
    主站蜘蛛池模板: 亚洲看片无码在线视频| 国产一区二区三区无码免费| 在线观看的免费网站无遮挡| 久久免费公开视频| 久久成人免费大片| 亚洲精品视频免费在线观看| 1000部拍拍拍18免费网站| 最近中文字幕2019高清免费| 91久久青青草原线免费| 免费观看AV片在线播放| 麻豆国产入口在线观看免费| 国产精品无码素人福利免费 | 日韩亚洲翔田千里在线| 特级无码毛片免费视频| 手机看片国产免费永久| 91大神免费观看| 国产麻豆免费观看91| 国产乱辈通伦影片在线播放亚洲 | 亚洲成人一区二区| 久久久久久久久亚洲| 亚洲中文字幕一二三四区| 免费一级毛片在线播放放视频| 最近免费mv在线观看动漫 | 午夜两性色视频免费网站| 一级毛片直播亚洲| 亚洲酒色1314狠狠做| 爱情岛亚洲论坛在线观看| 国产无遮挡裸体免费视频在线观看| 日韩在线播放全免费| 亚洲无码精品浪潮| 亚洲六月丁香婷婷综合| 国产97视频人人做人人爱免费| 真人做人试看60分钟免费视频| 亚洲精品第一国产综合精品99| 亚洲avav天堂av在线网爱情| 精品国产污污免费网站入口在线| 毛片基地免费视频a| 久久亚洲AV成人无码| 免费无遮挡无遮羞在线看| 无码永久免费AV网站| 亚洲午夜在线电影|