Mercurial > hg > RemoteEditor > REPSessionManager
changeset 273:d6a33e295d47
*** empty log message ***
author | kono |
---|---|
date | Mon, 22 Sep 2008 18:21:35 +0900 (2008-09-22) |
parents | 4d9058761c90 |
children | ad487e63e3c8 |
files | rep/channel/REPSelectionKey.java rep/handler/REPHandlerInMerge.java test/channeltest/testSeMa.java test/channeltest/testSeMaSlave.java |
diffstat | 4 files changed, 23 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/rep/channel/REPSelectionKey.java Thu Sep 11 17:24:44 2008 +0900 +++ b/rep/channel/REPSelectionKey.java Mon Sep 22 18:21:35 2008 +0900 @@ -44,24 +44,24 @@ return null; } - - public SelectableChannel channel(REPPack<P>packer) { - if (REPServerSocketChannel.isSimulation) return key.channel(); - if (key.isAcceptable()) { - //System.err.println("AcceptP selectionKey.channel = "+key.channel()); - SelectableChannel sc = key.channel(); - SelectableChannel rsc = REPSocketChannel.channels.get(sc); - if (rsc!=null) return rsc; - return new REPServerSocketChannel<P>(key.channel(),packer); - } else if (key.isReadable()) { - //System.err.println("ReadP selectionKey.channel = "+key.channel()); - SelectableChannel sc = key.channel(); - SelectableChannel rsc = REPSocketChannel.channels.get(sc); - if (rsc!=null) return rsc; - return new REPSocketChannel<P>(key.channel(),packer); - } - return null; - } +// +// public SelectableChannel channel(REPPack<P>packer) { +// if (REPServerSocketChannel.isSimulation) return key.channel(); +// if (key.isAcceptable()) { +// //System.err.println("AcceptP selectionKey.channel = "+key.channel()); +// SelectableChannel sc = key.channel(); +// SelectableChannel rsc = REPSocketChannel.channels.get(sc); +// if (rsc!=null) return rsc; +// return new REPServerSocketChannel<P>(key.channel(),packer); +// } else if (key.isReadable()) { +// //System.err.println("ReadP selectionKey.channel = "+key.channel()); +// SelectableChannel sc = key.channel(); +// SelectableChannel rsc = REPSocketChannel.channels.get(sc); +// if (rsc!=null) return rsc; +// return new REPSocketChannel<P>(key.channel(),packer); +// } +// return null; +// } @Override public int interestOps() {
--- a/rep/handler/REPHandlerInMerge.java Thu Sep 11 17:24:44 2008 +0900 +++ b/rep/handler/REPHandlerInMerge.java Mon Sep 22 18:21:35 2008 +0900 @@ -22,17 +22,11 @@ this.sid = sid; } + @SuppressWarnings("unchecked") public void handle(REPSelectionKey<REPCommand> key) throws IOException { //マージ中のエディタの前のエディタのコマンドをWaitingListに追加する - REPSocketChannel<REPCommand> channel = (REPSocketChannel<REPCommand>) key.accept(new REPCommandPacker()); - REPCommand command = null; - - try { - command = channel.read(); - } catch (IOException e) { - e.printStackTrace(); - } - + REPSocketChannel<REPCommand> channel = (REPSocketChannel<REPCommand>) key.channel(); + REPCommand command = channel.read(); if(command.sid == sid){ Editor editor = manager.getEditor(channel); manager.addWaitingCommand(new PacketSet(channel, editor, command));
--- a/test/channeltest/testSeMa.java Thu Sep 11 17:24:44 2008 +0900 +++ b/test/channeltest/testSeMa.java Mon Sep 22 18:21:35 2008 +0900 @@ -71,7 +71,7 @@ }else if(key.isReadable()){ try { - REPSocketChannel<String> channel = (REPSocketChannel<String>) key.channel(pack); + REPSocketChannel<String> channel = (REPSocketChannel<String>) key.channel(); String packet; packet = channel.read(); if (packet==null) continue;
--- a/test/channeltest/testSeMaSlave.java Thu Sep 11 17:24:44 2008 +0900 +++ b/test/channeltest/testSeMaSlave.java Mon Sep 22 18:21:35 2008 +0900 @@ -68,7 +68,7 @@ }else if(key.isReadable()){ try { - REPSocketChannel<String> channel = (REPSocketChannel<String>) key.channel(pack); + REPSocketChannel<String> channel = (REPSocketChannel<String>) key.channel(); String packet = channel.read(); if (packet==null) continue; //if (channel==masterCH){