第107课: Spark Streaming电商广告点击综合案例底层数据层的建模和编码实现(基于MySQL)
/*王家林老师授课http://weibo.com/ilovepains 每天晚上20:00YY频道现场授课频道68917580*/
一:数据层的建模在大数据项目中的地位,至关重要 1、数据库可以非常高效的读、写 2、传统IT系统基于大数据
二:基于Mysql存储spark结果数据实战
class JDBCWrapper{
private static JDBCWrapper jdbcInstance =null;
private static LinkedBlockingQueue
dbConnetionPool =new LinkedBlockingQueue
();
static {
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static JDBCWrapper getJDBCInstance() throws InterruptedException{
if (jdbcInstance ==null){
synchronized(JDBCWrapper.class){ //只有一个线程进去
if (jdbcInstance ==null){ //第二个 线程发现不为空,返回