code_money_guji's Blog

Happy coding

给 code_money_guji 留言

登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter

Avatar_small
Zalterfeele 说:
2018年10月25日 01:32

graph on sildenafil,cialis,vardenafil potency&47;streanths
[url=http://tadalafilatwalmart.net]cialis over counter
[/url] fixed drug eruption and cialis
<a href="http://tadalafilatwalmart.net">cialis over the counter
</a> - prozac compatability with cialis
cialis online sales

Avatar_small
Gabzieltarse 说:
2018年10月24日 13:11

cialis information sheet log out
http://walmartcialis.com - cialis over counter at walmart
cialis dose contains no unread posts
<a href="http://walmartcialis.com">cialis over the counter at walmart
</a> - cialis side effects cialis information if this is your first visit be sure to check out the faq by
cialis online canada vbulletin solutions

Avatar_small
Walzacezed 说:
2018年10月14日 18:18

custom writing discount code
http://essayfasthelp.com - custom writing
instant paper writer
<a href="http://essayfasthelp.com">essay writing service
</a> - custom writings discount code
medical school personal statement writing service

Avatar_small
BruzeHam 说:
2018年10月13日 07:04

medicine viagra
[url=http://viagrawithoutdoctorpharm.com]viagra without a doctor prescription usa
[/url] canadian pharmacy viagra 20mg i forgot my password
<a href="http://viagrawithoutdoctorpharm.com">viagra without a doctor prescription usa
</a> - viagra for women dosage social groups
viagra 20mg you cannot reply to topics in this forum

Avatar_small
Keznethvag 说:
2018年10月09日 19:18

coursework in english
http://writemyessayassistant.com - paper writing service
pay to write an essay
<a href="http://writemyessayassistant.com">write my paper
</a> - essay writing companies
technical writing service

Avatar_small
JerezyDab 说:
2018年10月09日 03:01

no prescription viagra montreal canada
http://gtviagracan.com - viagra for sale
viagra vs viagra ibbs.cgi
<a href="http://gtviagracan.com">viagra for sale
</a> - viagra 5mg cost forum software
viagra for women does it work jump to

Avatar_small
Szottamaro 说:
2018年10月05日 04:58

levitra generic canada your profile
http://levitragtr.com - levitra 20 mg mixing levitra with amoxiclav side effects
<a href="http://levitragtr.com">levitra 20 mg</a> - levitra, levitra, genuine generic
levitra coming and holding an erection

Avatar_small
[url=http://www.i-on 说:
2018年9月03日 21:57

Looking for <a href=http://ii-online-casino.com>casino</a>?Check out top free <a href=http://www.i-online-casino.org/>casino online</a> bonus offers at <a href=http://www.i-online-casino.org/Slotocash-Casino.html>online casino</a>

Avatar_small
pay day loans cash a 说:
2017年10月28日 23:59

pay day loans
cash advance loan
online loans
payday loan direct lender

Avatar_small
buy cialis new zeala 说:
2017年8月10日 21:39

buy cialis new zealand
tadalafil
cialis generique discount

Avatar_small
часы 说:
2017年2月12日 14:59


<a href=http://xn----8sbwhzpef4b3bg.xn--j1amh/content/15-naruchnye-chasy-izyuminka-dlya-vashego-imidzha>Наручные часы – изюминка для вашего имиджа</a> купить в Украине в интернет-магазине с доставкой наложкой

<a href=http://xn----8sbwhzpef4b3bg.xn--j1amh/><img>http://xn----8sbwhzpef4b3bg.xn--j1amh/upload/stowlcarousel/7dc1ada023d8d1a01c939bfce5047be9.jpg</img></a>

Avatar_small
I rellay couldn't as 说:
2013年6月14日 14:59

I rellay couldn't ask for more from this article.

Avatar_small
coffee 说:
2013年5月07日 17:31

 

你好! 今天需要写网络文件传输,先做了一个本地的文件文件多线程拷贝的测试,使用的MappedByteBuffer,但是在10个线程拷贝文件块的时候出现了访问文件锁的问题 java.lang.Error: Cleaner terminated abnormally at sun.misc.Cleaner$1.run(Cleaner.java:130) at java.security.AccessController.doPrivileged(Native Method) at sun.misc.Cleaner.clean(Cleaner.java:127) at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:124) Caused by: java.io.IOException: 另一个程序已锁定文件的一部分,进程无法访问。 at sun.nio.ch.FileChannelImpl.unmap0(Native Method) at sun.nio.ch.FileChannelImpl.access$100(FileChannelImpl.java:32) at sun.nio.ch.FileChannelImpl$Unmapper.run(FileChannelImpl.java:667) at sun.misc.Cleaner.clean(Cleaner.java:125) ... 1 more 这个异常.我使用的AtomicLong作为文件拷贝起始位置pos的记录,所以应该不会出现写入块复合的问题.在5个线程拷贝的时候并不会出现这个问题的.,我测试的文件是3.3G,很奇怪,看到你有一篇文章也是写使用内存映射实现文件拷贝,所以想和你探讨一下,附上我的测试代码,请帮我看看为什么线程到达10个的时候会报错,如果有答案可以联系我,邮件coffee_hc@163.com.QQ:58848232

public class FileTest {
public static void main(final String[] args) {
File file = new File("d:/src.dmp");
File newFile = new File("d:/test.dmp");
final long fileSize = file.length();
newFile.delete();
try {
RandomAccessFile oldRandomAccessFile = new RandomAccessFile(file, "r");
final FileChannel oldChannel = oldRandomAccessFile.getChannel();
RandomAccessFile randomAccessFile = new RandomAccessFile(newFile, "rw");
randomAccessFile.setLength(fileSize);
final FileChannel newChannel = randomAccessFile.getChannel();
long startTime = System.currentTimeMillis();
System.out.println("fileSize:" + fileSize);
final int copySize = 1024 * 1024;
final AtomicLong i = new AtomicLong(0);
int theardNum = 10;
final CountDownLatch countDownLatch = new CountDownLatch(theardNum);
for (long num = 0; num < theardNum; num++) {
Thread t = new Thread(new Runnable() {
 
@Override
public void run() {
while (true) {
long pos = i.getAndAdd(copySize);
int cSize = copySize;
if (pos < fileSize) {
cSize = (int) ((fileSize - pos) > cSize ? cSize : fileSize - pos);
try {
System.out.println(pos + "----" + cSize);
MappedByteBuffer inBuffer = oldChannel.map(MapMode.READ_ONLY, pos, cSize);
MappedByteBuffer outBuffer = newChannel.map(MapMode.READ_WRITE, pos, cSize);
outBuffer.put(inBuffer);
outBuffer.load();
} catch (Exception e) {
e.printStackTrace();
break;
} finally {
System.gc();
}
} else {
break;
}
 
}
countDownLatch.countDown();
}
});
t.start();
}
countDownLatch.await();
randomAccessFile.close();
oldRandomAccessFile.close();
long endTime = System.currentTimeMillis();
double speed = 1.0D * fileSize / (endTime - startTime) / 1024 / 1024 * 1000;
System.out.println("拷贝速度:" + speed + "M/S");
} catch (Exception e) {
e.printStackTrace();
}
}
}