private void finishReceivingFile(final boolean isSucceed) {
		try {
			this.writeChannel.truncate(receivedLength);
			this.writeChannel.force(true);
			this.writeChannel.close();
			this.writingFile.close();
		} catch (Exception e) {
			e.printStackTrace(System.out);
		}
		if (!isSucceed) {
			this.localReceivingFile.delete();
			if (this.isCancelReceivingFile) {
				this.addMessageToWriteQueue(new CoreMessage(CoreMessageType.FILE_RECEIVING_CANCELLED, null));
				if (GlobalUtil.SHOW_SYSTEM_OUT)
					System.out.println(Thread.currentThread().getId() + " Trigger onReceivingCancelled event for file " + this.receivingFile.fileName);
				GlobalUtil.threadExecutor().execute(new Runnable() {
					@Override
					public void run() {
						fileReceivingEventHandler.onReceivingCancelled(receivingFile.copy());
					}
				});
			} else {
				if (GlobalUtil.SHOW_SYSTEM_OUT)
					System.out.println(Thread.currentThread().getId() + " Trigger onReceivingFailed event for file " + this.receivingFile.fileName);
				GlobalUtil.threadExecutor().execute(new Runnable() {
					@Override
					public void run() {
						fileReceivingEventHandler.onReceivingFailed(receivingFile.copy(), GlobalUtil.OTHE_RREASON);
					}
				});
			}
		} else {
			this.addMessageToWriteQueue(new CoreMessage(CoreMessageType.FILE_RECEIVED, null));
			if (GlobalUtil.SHOW_SYSTEM_OUT)
				System.out.println(Thread.currentThread().getId() + " Trigger onReceivingSucceed event for file " + this.receivingFile.fileName);
			GlobalUtil.threadExecutor().execute(new Runnable() {
				@Override
				public void run() {
					fileReceivingEventHandler.onReceivingSucceed(receivingFile.copy());
				}
			});
		}
		this.mappedReceivingBuffer = null;
		this.isCancelReceivingFile = false;
		this.isReceivingFile = false;
		this.isWaitingRemote = false;
		this.lastAliveTime = System.currentTimeMillis();
		long timeCost = (System.currentTimeMillis() - this.startReceivingTime) / 1000;
		if (GlobalUtil.SHOW_SYSTEM_OUT)
			System.out.println(Thread.currentThread().getId() + " End receiving file '" + this.receivingFile.fileName + "' with " + this.receivedLength + " bytes. Time cost: " + timeCost
					+ " seconds.");
	}