摘要:
1、MapReduce 运行流程 (1)、JobClient 调用 submitJob(),提交Job (2)、JobClient 向 JobTracker 请求一个新的JobId(调用 JobTracker.getNewJobId() ) (3)、JobClient检查作业的输出说明,计算作业的输 阅读全文
posted @ 2014-05-28 08:48
lihui1625
阅读(126)
评论(0)
推荐(0)
摘要:
《精通正则表达式》 第401页 public static ListsplitCSV(String txt) { String reg = "\\G(?:^|,)(?:\"([^\"]*+(?:\"\"[^\"]*+)*+)\"|([^\",]*+))"; // 即 ... 阅读全文
posted @ 2014-05-28 08:47
lihui1625
阅读(798)
评论(0)
推荐(0)
摘要:
待续 阅读全文
posted @ 2014-05-28 08:47
lihui1625
阅读(84)
评论(0)
推荐(0)
摘要:
1.数据节点储存 org.apache.hadoop.hdfs.server.datanode.DataStorage public class DataStorage extends Storage { // Constants final static String BLOCK_SUBDIR_P 阅读全文
posted @ 2014-05-28 08:47
lihui1625
阅读(355)
评论(0)
推荐(0)
摘要:
1. 客户端与NameNode接口 org.apache.hadoop.hdfs.protocol.ClientProtocol public interface ClientProtocol extends VersionedProtocol { public int GET_STATS_CAPA 阅读全文
posted @ 2014-05-28 08:47
lihui1625
阅读(192)
评论(0)
推荐(0)
摘要:
1. Hadoop 抽象文件系统 org.apache.hadoop.fs.FileSystem,具体HDFS是这个抽象类的子类 publicabstractclassFileSystemextendsConfiguredimplementsCloseable{ publicstaticfinalS 阅读全文
posted @ 2014-05-28 08:47
lihui1625
阅读(428)
评论(0)
推荐(0)
摘要:
1. Java 默认序列化 public class Block1 implements Serializable { private static finallong serialVersionUID = 1276464248616673062L; privatelong blockId; pri 阅读全文
posted @ 2014-05-28 08:47
lihui1625
阅读(121)
评论(0)
推荐(0)
摘要:
1.客户端 公司产品的客户端的使用阻塞式的Socket,并没有使用NIO,在Hadoop中遇到再议。 2.服务器端 2.1 阻塞式 例子程序 public class BIOServer { static class Hanlder extendsThread { privateSocket soc 阅读全文
posted @ 2014-05-28 08:47
lihui1625
阅读(138)
评论(0)
推荐(0)
摘要:
1. 测试wordcount,其源码如下: public class WordCount { public static classTokenizerMapper extends Mapper{ ............ } } public static classIntSumReducer ex 阅读全文
posted @ 2014-05-28 08:47
lihui1625
阅读(116)
评论(0)
推荐(0)
摘要:
1、对共享的JAVA对象的访问可以通过将其方法声明为同步的而被串行化.当这种对象被复制时,这种方法足以保证访问的串行化吗? 答:不能.问题是对每一个复制对象的访问是串行化的.但是对不同的复制对象可以在同一时间进行不同的操作,使得复制的实例变量不一致. 2、对于第一章所讨论的监视器,如果允许在一个复制 阅读全文
posted @ 2014-05-28 08:47
lihui1625
阅读(815)
评论(0)
推荐(0)
摘要:
1、说出至少三种可在WWV广播时间和在分布式系统中处理机设置内部时钟之间引入的延迟源。 答:信号在大气中的传播延迟,当机器在协调WWV接受者与以太网时的碰撞延迟,包在局域网上的传播延迟,各个处理器由于中断处理延迟和内部队列延迟所产生的延迟。 2、考虑分布式系统中的两台机器的行为。这两台机器的时钟假设 阅读全文
posted @ 2014-05-28 08:47
lihui1625
阅读(1033)
评论(0)
推荐(0)
摘要:
1. Q: Give an example of where an address of an entity Eneeds to be further resolved into another address to actuallyaccess E. A: IP addresses in the 阅读全文
posted @ 2014-05-28 08:47
lihui1625
阅读(385)
评论(0)
推荐(0)
摘要:
待续 阅读全文
posted @ 2014-05-28 08:47
lihui1625
阅读(72)
评论(0)
推荐(0)
摘要:
1.发送请求:query.getCPUStatus("Intel"); 2.传送到:RPCInvoker.invoke(Object proxy, Method method, Object[]args) 其中method:publicabstract org.hadoopinternal.ipc. 阅读全文
posted @ 2014-05-28 08:47
lihui1625
阅读(91)
评论(0)
推荐(0)
摘要:
1. ClientCall的 wait() 和 notify() public class Client { public Writablecall(Writable param, ClientConnectionId remoteId) throwsInterruptedException, IO 阅读全文
posted @ 2014-05-28 08:47
lihui1625
阅读(110)
评论(0)
推荐(0)
摘要:
1. RPCClientCache 中的 clients publicclass RPCClientCache { private Map<SocketFactory,Client> clients = new HashMap<SocketFactory,Client>(); synchronize 阅读全文
posted @ 2014-05-28 08:47
lihui1625
阅读(193)
评论(0)
推荐(0)
摘要:
1.服务器端主要类 public abstractclass Server { public static final ByteBuffer HEADER =ByteBuffer.wrap("hrpc".getBytes()); public static final byte CURRENT_VE 阅读全文
posted @ 2014-05-28 08:47
lihui1625
阅读(105)
评论(0)
推荐(0)
摘要:
0 <= position <= limit <= capacity Buffer.clear(): 清空数据。limit = capacity,position = 0 Buffer.flip(): 调整指针供读写。limit = position,position = 0 Buffer.rewi 阅读全文
posted @ 2014-05-28 08:47
lihui1625
阅读(164)
评论(0)
推荐(0)
摘要:
1. 数据记录FileStatus public class FileStatus implements Writable { private String filename; private long time; static { // register IPCFileStatus Writabl 阅读全文
posted @ 2014-05-28 08:47
lihui1625
阅读(173)
评论(0)
推荐(0)
摘要:
1.数据记录FileStatus public class FileStatus { private String filename; private long time; public FileStatus(String filename) { this.filename=filename; th 阅读全文
posted @ 2014-05-28 08:47
lihui1625
阅读(95)
评论(0)
推荐(0)
摘要:
两个连接请求发出后,生成ClientConnectionId对象,只要两个ClientConnectionId对象的hashcode相同,就视为一个同一个连接,从而复用ClientConnection publicRPCInvoker(Class《?extendsVersionedProtocol》 阅读全文
posted @ 2014-05-28 08:47
lihui1625
阅读(99)
评论(0)
推荐(0)
摘要:
两个连接请求发出后,生成ClientConnectionId对象,只要两个ClientConnectionId对象的hashcode相同,就视为一个同一个连接,从而复用ClientConnection publicRPCInvoker(Class《?extendsVersionedProtocol》 阅读全文
posted @ 2014-05-28 08:47
lihui1625
阅读(227)
评论(0)
推荐(0)
摘要:
1.SelectionKey.OP_ACCEPT publicclassServerListenerextendsThread{ publicServerListener(Serverserver) throwsIOException{ this.server=server; address=new 阅读全文
posted @ 2014-05-28 08:47
lihui1625
阅读(141)
评论(0)
推荐(0)
摘要:
1.SelectionKey.OP_ACCEPT publicclassServerListenerextendsThread{ publicServerListener(Serverserver) throwsIOException{ this.server=server; address=new 阅读全文
posted @ 2014-05-28 08:47
lihui1625
阅读(117)
评论(0)
推荐(0)
摘要:
1.Server的wait、notify public abstractclass Server { public synchronized void join()throws InterruptedException { while (running){ wait(); } } public sy 阅读全文
posted @ 2014-05-28 08:47
lihui1625
阅读(118)
评论(0)
推荐(0)
摘要:
1.Server的 callQueue 典型的生产者-消费者模式 public abstractclass Server { BlockingQueue<ServerCall> callQueue; } publicclass ServerConnection { privatevoid proce 阅读全文
posted @ 2014-05-28 08:47
lihui1625
阅读(115)
评论(0)
推荐(0)
摘要:
1.Server 的 running public abstract class Server { volatile boolean running =true; // true while server runs publicsynchronized void join() throwsInter 阅读全文
posted @ 2014-05-28 08:47
lihui1625
阅读(88)
评论(0)
推荐(0)
摘要:
1.Class类的running 用于主线程的Client 和若干 ClientConnection 线程之间 共享Client的running变量 public classClient { public AtomicBoolean running = newAtomicBoolean(true); 阅读全文
posted @ 2014-05-28 08:47
lihui1625
阅读(144)
评论(0)
推荐(0)
摘要:
http://www.blogjava.net/watchzerg/archive/2012/09/22/388346.html mongoDB java驱动学习笔记 指定新mongo实例: Mongo m = new Mongo(); Mongo m = new Mongo( "localhost 阅读全文
posted @ 2014-05-28 08:46
lihui1625
阅读(145)
评论(0)
推荐(0)
摘要:
1.比较使用单线程文件服务器读取文件和使用多线程服务器读取文件有什么不同。花费15ms来接收请求、调度该请求并且完成其它必须的处理工作,假定需要的数据存放在主存储器的缓存中。如果需要磁盘操作,就需要额外多花75ms在磁盘操作的过程中线程处于睡眠状态。如果服务器采用单线程的话,它每秒能处理多少个请求? 阅读全文
posted @ 2014-05-28 08:46
lihui1625
阅读(1130)
评论(0)
推荐(0)