- 浏览: 9654 次
- 性别:
- 来自: 济南
-
最新评论
文章列表
[置顶] 1) eclipse 添加字体
- 博客分类:
- eclipse
* 假设在字体当中没有找到你想要的字体,那么点击“显示更多字体”,会显示系统所有字体,找到你要的字体右键选择显示。返回字体设置对话框,选择新添加的字体。
@echo off
title stop/start windows service
:allStart
cls
echo [1] MySQL
echo [2] Apache
echo [3] Windows Update
echo [4] Oracle
echo [5] VMWare
echo [e] exit
set in=
set /p in=please enter the num:
if "%in%"=="1" goto mysql
if "%in%"=="2" goto a ...
3)用zookeeper实现分布式锁
- 博客分类:
- ZooKeeper
在我们的项目当中,可能有许多组件在并行的运行。这些组件可能需要更新我们的数据存储。所以这些组件应该有解决冲突的能力,避免脏数据。但是这些组件往往运行在不同的服务器上,甚至编程语言,文件系统结构都是不同的。这些差异给我们的分布式协作带来困难。
zookeeper给我们提供了解决方案。那么如何借助zookeeper来管理我们的分布式系统,达到系统之间的协作呢?我们可以通过zookeeper来实现分布式锁的概念,从而达到系统之间的协作目的。
public class DistributedLock {
private final ZooKeeper zk;
...
1) the Stat structure of znode
在zookeeper的数据模型中,每个数据节点称为znode. 每个znode维护一个Stat structure.这个Stat structure 由下面几个属性构成:
·czxid
每一次对zookeeper znode做的更新都会对应唯一transactionID,这个id称为zxid.由于zxid是递增的,所以它实际上表示对zookeeper更新的一种顺序。例如zxid1 小于 zxid2 那么zxid1对应的操作在zxid2对应的操作之前发生。
Czxid表示znode ...
1)zookeeper数据模型
- 博客分类:
- ZooKeeper
1.1 数据模型
Zookeeper 维护一个层级的命名空间。这个命名空间就像一个文件系统。如图1-1所示:
图1-1 zookeeper的数据模型
在每个节点上都可以有数据与该节点相关联。就像父节点下面可以有子节点。数据不应该太大,不应该大于1M数据。Zookeeper不是用来做数据存储的,操作大数据会影响性能,如果迫不得已要进行大数据的操作,建议只在znode里面存储数据的位置。
到每个节点的路径被表示成标准的,绝对的,以斜线分隔的路径。不存在相对路径,所以路径中存在 ”.”, ”..” 是不被允许的。
“zookeeper”作为保留字在路径中不被使用。
异常:
2014-02-16 22:07:19,284 [myid:] - WARN [main-SendThread(192.168.177.128:2181):ClientCnxn$SendThread@1089] -
Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection timed out: no further information
at ...
写道
[ERROR] Failed to execute goal on project zookeeper: Could not resolve dependencies for project com.zqz:zookeeper:jar:1.0-SNAPSHOT: The following artifacts could not be resolved: javax.jms:jms:jar:1.1, com.sun.jdmk:jmxtools:jar:1.2.1, com.sun.jmx:jmxri:jar:1.2.1: Could not transfer artifact java ...
1)创建maven项目
在命令行中,进入到项目所在的路径,比如:D:\MyProjects 运行如下命令:
mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
groupId为包名,artifactId为项目名。
命令运行成功后会在当前目录下建立你的maven项目。
目录结构如下所示:
The s ...
ActiveMQ 安装(1)
- 博客分类:
- EMS
Pre-Installation Requirements
Hardware:
33 MB of free disk space for the ActiveMQ 4.x binary distribution.
200 MB of free disk space for the ActiveMQ 4.x source or developer's distributions.
Operating Systems:
Windows: Windows XP SP2, Windows 2000, Windows Vista, Windows 7.
Unix: Ubuntu Li ...
Maven其实就是一个java tool.
系统要求
JDK:JDK1.5或者1.5以上。
内存空间和磁盘空间没有限制。
操作系统,windows和linux都可以装
安装步骤:
For Windows
1.解压缩 apache-maven-3.1.1-bin.zip 到你想安装maven到哪个目录里面,假设你选择了C:\Program Files\Apache,解压缩后会生成一个子目录--apache-maven-3.1.1。
2.设置系统环境变量M2_HOME,变量值为C:\Program Files\Apache Software Found ...
JMS Message
- 博客分类:
- EMS
1)recap
The Message interface is the root interface of all JMS messages. It defines the message header and the acknowledge method used for all messages.
Most message-oriented middleware (MOM) products treat messages as lightweight entities that consist of a header and a payload. The hea ...
JMS结构模型
1.ConnectionFactory
A ConnectionFactory object encapsulates a set of connection configuration parameters that has been defined by an administrator. A client uses it to create a connection with a JMS provider.
A C ...
In order to facilitate the sending of domain model objects, the JmsTemplate has various send methods that take a Java object as an argument for a message's data content. The overloaded methods convertAndSend and receiveAndConvert in JmsTemplate delegate the conversion process to an instance of the ...
The JmsTemplate contains many convenience methods to send a message. There are send methods that specify the destination using a javax.jms.Destination object and those that specify the destination using a string for use in a JNDI lookup. The send method that takes no destination argument uses the d ...