Skip to content

Instantly share code, notes, and snippets.

View optor666's full-sized avatar
🏠
Working from home

optor optor666

🏠
Working from home
View GitHub Profile
@optor666
optor666 / java
Created May 15, 2018 11:21
Multi Thread Write Example
import java.io.FileWriter;
import java.io.IOException;
public class FileWriterExample2 {
public static void main(String[] args) throws IOException, InterruptedException {
FileWriter fw = new FileWriter("/tmp/test", true);
FileWriter fw2 = new FileWriter("/tmp/test", true);
char[] chars = new char[1024 * 1024 * 4];
for (int i = 0; i < 4 * 1024 * 1024; i++) {
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby